下面的curl命令起作用:
curl -vx proxy.example.com:8010 -U user:pass http://example.com并返回响应代码为200的有效内容。
但是,通过python请求库使用的相同凭据会产生407状态代码(身份验证错误)。在查看日志时,看起来用户从未被传递过(未定义)。
url = "http://example.com"
proxies = {'http': 'http://proxy.example.com:8010'}
auth = HTTPProxyAuth("user", "pass")
resp = requests.get(url, proxies=proxies, auth=auth)我使用的是请求库2.3.0。
发布于 2014-09-25 04:42:44
最终,通过在URL中使用"https“而不是"http”解决了该问题。
我只能推测为什么这是解决方案:可能是requests库的不同版本或某个bug?我将调查这些问题,看看为什么这样做有效。
https://stackoverflow.com/questions/26023888
复制相似问题