爬虫的时候遇到的一个错误 Max retries exceeded with URL in requests
requests.exceptions.ConnectionError: HTTPSConnectionPool:
Max retries exceeded with url: ××××××××××××××××××××××××××××××××
(Caused by <class 'socket.gaierror'>: [Errno -2] Name or service not known)
我的解决办法:
import requests
try:
r = requests.get(ap)
except requests.exceptions.ConnectionError as e:
print str(e)
<