PyDocs

Nav

Internet Protocols and Support

ProxyHandler

urllib.request

class (source) not WASI
  • ProxyHandler(proxies=None)
Cause requests to go through a proxy. If proxies is given, it must be a dictionary mapping protocol names to URLs of proxies. The default is to read the list of proxies from the environment variables <protocol>_proxy. If no proxy environment variables are set, then in a Windows environment proxy settings are obtained from the registry’s Internet Settings section, and in a macOS environment proxy information is retrieved from the System Configuration Framework.
1 Example
>>> import urllib.request
>>> proxies = {'http': 'http://proxy.example.com:8080/'}
>>> opener = urllib.request.build_opener(urllib.request.ProxyHandler(proxies))
>>> with opener.open("https://www.python.org") as f:
...     f.read().decode('utf-8')
...
from the Python docs
See Also
No see-alsos for urllib.request/ProxyHandler
0 Notes
No notes for ProxyHandler