Getting JSON response from Instagram stories API Python

I got this API request when open a story on Instagram Login • Instagram
But, the issue is that when you open the same link even in the browser, it gives this response back
{"message":"useragent mismatch","status":"fail"}
How can we get the correct response back which is shown in the network tab? Or is it possible to get the content directly from the chrome dev tool network tab?

I have attached the screenshot of from network tab below
image

Hey @CodeWithAwais and welcome!

In general, it’s often not the most reliable to copy DevTools requests. Rather, try making use of the official Instagram API.

If you’re determined to follow this path, make sure everything in your Python session is the same as in your browser session. Think about not only URLs and their parameters, but also cookies and, what seems to break you up in this case, headers like the User-Agent header.

If you’re using the Python requests module, you can use a request.Session() and pass in those headers and cookies from the start.