Skip to main content

Proxy auto-config and auto-discovery for Python.

Project description

https://img.shields.io/pypi/v/pypac.svg?maxAge=2592000 https://img.shields.io/travis/carsonyl/pypac.svg?maxAge=2592000 https://ci.appveyor.com/api/projects/status/y7nxvu2feu87i39t/branch/master?svg=true https://img.shields.io/coveralls/carsonyl/pypac/HEAD.svg?maxAge=2592000 https://img.shields.io/codacy/grade/71ac103b491d44efb94976ca5ea5d89c.svg?maxAge=2592000

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.

Features

  • The same Requests API that you already know and love

  • Honour PAC setting from Windows Internet Options

  • Follow DNS Web Proxy Auto-Discovery protocol

  • Proxy authentication pass-through

  • Proxy failover and load balancing

PyPAC supports Python 2.7 and 3.3+.

Installation

Install PyPAC using pip:

$ pip install pypac

Documentation

PyPAC’s documentation is available at http://pypac.readthedocs.io/.

0.6.0 (2018-01-28)

  • Add pac_context_for_url, a context manager that adds basic PAC functionality through proxy environment variables.

0.5.0 (2018-01-18)

  • Accept PAC files served with no Content-Type header.

0.4.0 (2017-11-07)

  • Add recursion_limit keyword argument to PACSession and PACFile. The default is an arbitrarily high value (10000), which should cover most applications.

  • Exclude port numbers from host passed to FindProxyForURL(url, host).

0.3.1 (2017-06-23)

  • Update GitHub username.

0.3.0 (2017-04-12)

  • Windows: Get system auto-proxy config setting using winreg module.

  • Windows: Accept local filesystem paths from system proxy auto-config setting.

  • Raise PacComplexityError when recursion limit is hit while parsing PAC file.

  • Support setting PACSession.proxy_auth and ProxyResolver.proxy_auth after constructing an instance.

  • Narrative docs.

0.2.1 (2017-01-19)

  • Require Js2Py >= 0.43 for Python 3.6 support, and to avoid needing to monkeypatch out pyimport.

0.1.0 (2016-06-12)

  • First release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pypac-0.6.0-py2.py3-none-any.whl (20.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pypac-0.6.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pypac-0.6.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 47c534fcd59bb4736aa1312c1097bb60c0cc72a90615c927c46d5cb60869b3e9
MD5 7abaebbc6c8ecdaff274eca73889b56d
BLAKE2b-256 605adb84d01b8554819bb034d7171de456cecb5c687198fe3827198b4c2a610d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page