【发布时间】:2020-02-18 18:32:28
【问题描述】:
我正在尝试抓取一个 http 网站,但在尝试阅读该网站时出现以下错误。
HTTPSConnectionPool(host='proxyvipecc.nb.xxxx.com', port=83): Max retries exceeded with url: http://campanulaceae.myspecies.info/ (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden',)))
以下是我用类似网站编写的代码。我尝试使用 urllib 和 user-agent 仍然是同样的问题。
url = "http://campanulaceae.myspecies.info/"
response = requests.get(url, headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36'})
soup = BeautifulSoup(response.text, 'html.parser')
谁能帮我解决这个问题。提前致谢
【问题讨论】:
-
你多久尝试一次抓取它?
-
你是怎么解决的?
标签: python web-scraping http-error