无法建立新连接:[Errno 11002] getaddrinfo失败

时间:2018-10-09 07:08:09

标签: python connection

我正在制作网络抓取工具,但遇到一些错误。需要帮助。

我的代码:

import requests

from bs4 import BeautifulSoup

page = requests.get("https://www.google.com")

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

for x in soup.find_all('a'):
    print(x)

错误:

ConnectionError: HTTPSConnectionPool(host='www.google.com', port=443): 
Max retries exceeded with url: / (Caused by 
NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x0000016945AFB0F0>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed',))

0 个答案:

没有答案