问题描述
因此,我使用 Python 3.9.1 中的 requests
库发送请求。问题是,当我尝试使用 HTTP 代理时,它给了我这个错误:
raise MaxRetryError(_pool,url,error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='google.com',port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.',NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000002B08D6BC9A0>: Failed to establish a new connection:
[WinError 10060] A connection attempt Failed because the connected party did not properly respond after a period of time,or established connection Failed because connected host has Failed to respond')))
这是我的代码,我将不胜感激。:
import requests
for proxy in open('proxies.txt','r').readlines():
proxies = {
'http': f'http://{proxy}','https': f'http://{proxy}'
}
e = requests.get('https://google.com/robots.txt',proxies=proxies)
open('uwu.txt','a').write(e.text)
print(e.text)
我很确定我的代理没有问题,因为它们是具有 100 演出带宽的非常好的私人代理。 (来自 zenum.io)。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)