HTTPSConnectionP

2024-06-13 12:09:16 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图用Python 3.x从特定的网站上抓取数据,对于某些网站,它不允许我抓取,它显示的错误如下:

raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='....', port=443): Max retries exceeded with url: / (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10060]

电子邮件验证也经常发生这种情况。我想知道如何处理这些错误,解决办法是什么?在

谢谢你抽出时间。在

p.S.代码如下:

enrich_url = "..."

ua = UserAgent()
header = {'user-agent':ua.chrome}
website = requests.get(enrich_url, headers=header) <--- (error is showing here)

soup = BeautifulSoup(website.content, 'html.parser')

Tags: 数据url网站request错误websiterequestsexceptions