[英]Requests returns Too Many Requests status code
The goal is to return resp.text
for the account page目标是为帐户页面返回
resp.text
When you run this function you get the response code 429
that indicates too Many Requests were made.当您运行此 function 时,您会得到响应代码
429
,表明发出了太多请求。
even when running the script with proxychains proxychains python3 file.py
it returns the same status code即使使用 proxychains
proxychains python3 file.py
运行脚本,它也会返回相同的状态代码
file.py文件.py
import requests
def g3t_usr(acc):
""" Surf to account page """
resp = requests.get(f'https://www.instagram.com/{acc}/')
if resp.status_code == 200:
return resp.text
else:
print (resp.status_code)
return resp.text
acc="<some_random_user>"
g3t_usr(acc)
Does Instagram check for requests made by python requests and flags them Instagram 是否检查 python 请求发出的请求并标记它们
Try Specifying the „User-Agent“ in the header to make your request more „authentic“ like this: requests.get(f'https://www.instagram.com/{acc}/', headers={"User-Agent": "Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0"})
尝试在 header 中指定“用户代理”以使您的请求更“真实”,如下所示:
requests.get(f'https://www.instagram.com/{acc}/', headers={"User-Agent": "Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0"})
At my side, it worked and I got Status Code 200.在我这边,它起作用了,我得到了状态码 200。
Wish you luck!祝您好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.