I
I
igreklpofrss2021-12-05 20:53:12
Python
igreklpofrss, 2021-12-05 20:53:12

Why is JSON not coming?

My telegram bot sends requests to Instagram using the insta-library to get a link to the last post of my profile from JSON. I am requesting information as NOT an authorized user! Everything worked without interruptions and complaints all day (and before that a week), until the error got out:

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I decided to check with a print what was wrong - for some reason, instead of JSON, come an html page with the Login title. The section of code responsible for json did not touch at all. Perhaps this happened because while I was testing the other part of the code, I made a request to the server every time I ran it and the Instagram algorithms got tired of it. Questions: First, does it happen that the server starts to change the form of the response? Why didn't he return, for example, JSON with an error, but now he began to send exactly the html page? Secondly, what can be changed in the request to get the json object again? I understand that the measure is temporary and then I will receive json again, but I would like not to wait. How does insta remember who I am? Maybe you can change something in the request headers?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question