Http-隧道连接失败:403禁止Python web抓取错误
我试图从网页上抓取一个http网站,当我试图阅读该网站时,我发现下面的错误Http-隧道连接失败:403禁止Python web抓取错误,python,web-scraping,http-error,Python,Web Scraping,Http Error,我试图从网页上抓取一个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 faile
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和用户代理,但仍然存在相同的问题
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')
有人能帮我解决这个问题吗。提前感谢您应该在请求url时尝试添加代理
proxyDict = {
'http' : "add http proxy",
'https' : "add https proxy"
}
requests.get(url, proxies=proxyDict)
您可以找到更多信息您多久尝试刮取一次?您是如何解决的?我尝试添加代理,但没有显示任何错误。但当我试图提取文本时,它显示网页被阻止。***web页面被阻止***