我正在制作网络抓取工具,但遇到一些错误。需要帮助。
我的代码:
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',))