This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

PyPAC: Proxy auto-config 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 supports Python 2.7 and 3.3+.

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('')

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.

Proxy authentication

Basic proxy authentication can be specified in the PACSession constructor:

>>> from pypac import PACSession
>>> from requests.auth import HTTPProxyAuth
>>> session = PACSession(proxy_auth=HTTPProxyAuth('user', 'password'))
>>> session.get('')

To use NTLM authentication with proxies, install requests-ntlm and set PACSession.auth to an HttpNtlmAuth instance.


PAC files are JavaScript. PyPAC uses Js2Py to parse and execute JavaScript. Js2Py was not designed for handling untrusted JavaScript, and so it is unclear whether the handling of PAC files is sufficiently sandboxed to prevent untrusted Python code execution.

When looking for a PAC file using DNS WPAD, the local machine’s fully-qualified hostname is checked against the Mozilla Public Suffix List to prevent requesting any PAC files outside the scope of the organization. If the hostname’s TLD isn’t in the Public Suffix List, then everything up to the final node is used in the search path. For example, a hostname of will result in a search for a PAC file from and wpad.local.

PyPAC uses the tld library to match TLDs.

What’s missing

The DHCP portion of the Web Proxy Auto-Discovery (WPAD) protocol is not implemented.

PyPAC currently works with Requests by including a subclass of Session. No ready-to-use solutions are included for other HTTP libraries, though PyPAC has all the building blocks needed to make one easily.

Pull requests to add these features are welcome.


0.1.0 (2016-06-12)

  • First release.
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pypac-0.1.0-py2.py3-none-any.whl (17.9 kB) Copy SHA256 Checksum SHA256 any Wheel Jun 14, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting