Proxy auto-config and auto-discovery for Python.
PyPAC is a pure-Python library for finding proxy auto-config (PAC) files and making HTTP requests that respect them. PAC files are often used in organizations that need fine-grained and centralized control of proxy settings.
PyPAC provides a subclass of a Requests Session, so you can start using it immediately, with any PAC file transparently discovered and honoured:
>>> from pypac import PACSession >>> session = PACSession() >>> session.get('http://example.org') ...
If a PAC file isn’t found, then PACSession acts exactly like a regular Session.
PyPAC can find PAC files according to the DNS portion of the Web Proxy Auto-Discovery (WPAD) protocol. On Windows, PyPAC can also obtain the PAC file URL from the Internet Options dialog, via the registry.
PyPAC supports Python 2.7 and 3.3+.
Install PyPAC using pip:
$ pip install pypac
PyPAC’s documentation is available at http://pypac.readthedocs.io/.