将openers安装到urllib2不会影响请求。您需要使用请求自己的代理支持。它应该足以将它们传递给 proxies 论证 get ,或者你可以设置 HTTP_PROXY 和 HTTPS_PROXY 环境变量。看到 http://docs.python-requests.org/en/latest/user/advanced/#proxies
proxies
get
HTTP_PROXY
HTTPS_PROXY
import requests proxies = { "http": "http://10.10.1.10:3128", "https": "http://10.10.1.10:1080", } requests.get("http://example.org", proxies=proxies)
您是否尝试过在Intranet上使用代理下载文件?
你可以在python2中尝试这样的东西
from urllib2 import urlopen url = 'http://intranet/myfile.pdf' with open(local_filename, 'wb') as f: f.write(urlopen(url).read())