【发布时间】:2014-02-20 11:18:33
【问题描述】:
我有一个需要身份验证的 squid 代理。在squid.conf 我正在使用:
auth_param digest program /usr/lib64/squid/digest_pw_auth -c /etc/squid/passwords
auth_param digest realm proxy
acl authenticated proxy_auth REQUIRED
http_access allow authenticated
据此,我可以预期身份验证方法是http digest。
这是我的python代码:
from requests.auth import HTTPDigestAuth
auth = HTTPDigestAuth("user", "pass")
r = requests.get( "http://www.google.com", allow_redirects=True, headers=Configuration.HEADERS, proxies=proxy_list(), auth=auth )
我收到此错误:
407 Proxy Authentication Required
我也尝试过通过以下方式进行身份验证:
auth = HTTPProxyAuth('user', 'password')
和:
http://user:password@ip
没有运气......
有人可以帮忙吗?
谢谢
【问题讨论】:
-
什么是
proxies_list()? -
只是一个生成代理列表字典的函数
标签: python http proxy python-requests squid