【发布时间】:2022-01-18 23:58:57
【问题描述】:
所以我正在尝试抓取这个网站:https://www.auto24.ee 我能够毫无问题地从中抓取数据,但今天它给了我“响应 403”。我尝试使用代理,将更多信息传递给标题,但不幸的是似乎没有任何效果。我在互联网上找不到任何解决方案,我尝试了不同的方法。 之前运行没有任何问题的代码:
import requests
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36',
}
page = requests.get("https://www.auto24.ee/", headers=headers)
print(page)
【问题讨论】:
-
我认为你不需要欺骗用户代理。只要确保您避免使用该站点上
/robots.txt指定的资源
标签: python python-requests http-status-code-403 python-requests-html