1. Python
  2. 随笔一记

requests.exceptions.ProxyError :由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败

报错如下:

raise ProxyError(e, request=request)requests.exceptions.ProxyError: HTTPConnectionPool(host='114.235.22.147', port=9000): Max retries exceeded with url: http://sencq.sencom.top/ (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000020FEBBBD978>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。')))

由于前几天使用了代理,今天关闭代理爬虫就不工作了

去系统设置里去检查代理-》的确已经关闭了。

猜测:系统代理被篡改

import requests
import os
os.environ['NO_PROXY'] = 'sencq.sencom.top'
res=requests.get("http://sencq.sencom.top")
print(res)

这样写就可以正常工作,果然是系统的锅

但是这样不是长久之计!

继续查找。。。

注册表:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet SettingsHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings

下Proxy打头的都删除了就彻底解决了。

END