urllib3有一个
ProxyManager可以使用的组件。您需要为Basic
Auth组件构建标题,您可以手动执行此操作,也可以使用
make_headersurllib3中的帮助程序。
总之,它看起来像这样:
from urllib3 import ProxyManager, make_headersdefault_headers = make_headers(proxy_basic_auth='myusername:mypassword')http = ProxyManager("https://myproxy.com:8080/", headers=default_headers)# Now you can use `http` as you would a normal PoolManagerr = http.request('GET', 'https://stackoverflow.com/')


