Instagram blocks me for the requests with 429

690 views Asked by At

I have used a lot of requests to https://www.instagram.com/{username}/?__a=1 to check if a pseudo was existing and now I am getting 429.

Before, I had just to wait few minutes to make the 429 disapear. Now it is persistent ! :( I'm trying once a day, it doesnt work anymore.

Do you know anything about instagram requests limitation ?

Do you have any workaround please ? Thanks

Code ...

import requests
r = requests.get('https://www.instagram.com/test123/?__a=1')
res = str(r.status_code)
1

There are 1 answers

2
MendelG On BEST ANSWER

Try adding the user-agent header, otherwise, the website thinks that your a bot, and will block you.

import requests

URL = "https://www.instagram.com/bla/?__a=1"
HEADERS = {"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"}
response = requests.get(URL, headers=HEADERS)

print(response.status_code) # <- Output: 200