【发布时间】:2020-05-25 09:50:24
【问题描述】:
我正在尝试使用代理发出请求,但我不知道为什么
loadproxy = {
"https":"114.99.11.114:3000",
"http":"114.99.11.114:3000",
}
url = "http://httpbin.org/ip"
res = requests.get(url,proxies=loadproxy)
print(res.text)
文件“/usr/lib/python3/dist-packages/requests/adapters.py”,第 502 行,在发送中 引发 ProxyError(e, request=request) requests.exceptions.ProxyError: HTTPConnectionPool(host='114.99.11.114', port=3000): Max retries exceeded with url: http://httpbin.org/ip (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError(': 无法建立一个新的连接:[Errno 110] Connection timed out',)))
我不知道为什么它可以正常工作,因为错误代理无法正常工作,但我已经更改了很多代理以寻求帮助
在我更改代理时添加一个更多的保留,并且我更改了它并且我的代码看起来不错
loadproxy = {
"https":"118.69.50.154:80",
"http":"118.69.50.154:80",
}
url = "http://httpbin.org/ip"
res = requests.get(url,proxies=loadproxy)
print(res.text)
但这里的问题是它显示了我原来的 ip
{ “起源”:“my_ip” }
甚至代理都是匿名的
【问题讨论】:
-
我没有检查你的
<ipaddress>:<port>组合是否是一个有效的代理,但它肯定缺少协议。即"https":"https://114.99.11.114:3000"而不是"https":"114.99.11.114:3000" -
不,我试过了,但没有任何效果
标签: python python-3.x proxy python-requests