PyPAC
Proxy auto-config and auto-discovery for Python.
What it is and what it does
PyPAC is a Python library that integrates proxy auto-config (PAC) file discovery and enforcement into HTTP requests. It extends the Requests library with a PACSession class that automatically discovers PAC files via the WPAD protocol, Windows Internet Options, or macOS System Preferences, then routes requests through the proxies specified in those files. If no PAC file is found, it behaves like a regular Requests session.
The library handles proxy authentication, failover, and load balancing as defined in PAC files. It also provides a context manager (pac_context_for_url) for adding basic PAC support to libraries that honor proxy environment variables. The package depends on requests for HTTP, publicsuffixlist for domain matching, dukpy for JavaScript execution, and pyobjc-framework-SystemConfiguration for macOS integration.
Use it for:
- Make HTTP requests in corporate environments where PAC files centrally control proxy routing without manual configuration.
- Automatically discover and use organization-specific proxy settings on Windows or macOS without hardcoding proxy URLs.
- Add PAC support to AWS SDK calls (boto3) or other libraries via the pac_context_for_url context manager.
- Handle proxy failover and load balancing defined in PAC files for resilient HTTP clients.
- Respect DNS-based proxy discovery (WPAD) in networks that use it for automatic proxy configuration.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
PyPAC discovers proxy auto-config (PAC) files and makes HTTP requests that respect them, with automatic PAC discovery on Windows and macOS and support for the WPAD protocol.
Yes. PyPAC is actively maintained, has no known vulnerabilities, low install friction, and solves a real problem for developers in corporate environments. Install it if your application needs to respect PAC files or auto-discover proxies; skip it if you're in an environment with static proxy configuration or no proxy requirements.
Install
pypac on PyPI
pip
pip install pypacuv
uv add pypacpoetry
poetry add pypacInstalling PyPAC
Before you install
Low install friction with a pure-Python wheel. Actively maintained with a release 7 days ago and recent fixes for dukpy 0.6.0 compatibility and dependency consolidation.
License in practice
Apache-2.0 is permissive; you can use, modify, and distribute PyPAC freely in commercial and private projects with minimal restrictions.
Quickstart
pip install pypac
from pypac import PACSession
session = PACSession()
response = session.get('http://example.org')
Verify before relying
- Whether dukpy 0.6.0 support is complete or if there are known edge cases with PAC execution.
- Performance characteristics when PAC files are large or contain complex JavaScript logic.
- Whether pyobjc-framework-SystemConfiguration is required on all macOS versions or only specific ones.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — requests, publicsuffixlist, dukpy, pyobjc-framework-SystemConfiguration |
| Maintenance | actively maintained — 7 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 469,001/month — #6,490 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pypac-0.19.0-py2.py3-none-any.whl
Keywords: pypac, pac, proxy, autoconfig, requests
Tags
More Internet packages
Botocore provides low-level, data-driven access…
permissive · top 100 on PyPI
aiobotocoreProvides an async client for AWS services using…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
filelockProvides a platform-independent file locking…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
googleapis-common-protosProvides common Protocol Buffer message…
permissive · top 100 on PyPI
pproxypproxy is an asynchronous proxy server that…
permissive · top 15,000 on PyPI
WSGIProxy2WSGIProxy2 wraps a remote HTTP application as a…
permissive · top 15,000 on PyPI
PySocksPySocks provides a SOCKS and HTTP proxy client…
permissive · top 1,000 on PyPI
authcaptureproxyIntercepts and logs authentication credentials…
permissive · top 15,000 on PyPI
pyobjc-framework-SystemConfigurationProvides Python bindings to macOS's…
permissive · top 15,000 on PyPI
proxy.pyA lightweight, pluggable HTTP proxy server…
permissive · top 5,000 on PyPI
socksioSocksio is a sans-I/O SOCKS protocol…
permissive · top 1,000 on PyPI
mitmproxymitmproxy is an interactive, SSL/TLS-capable…
permissive · top 5,000 on PyPI
requests-ntlm3Provides HTTP NTLM authentication for the…
permissive · top 15,000 on PyPI
tldextractAccurately extracts subdomain, domain, and…
permissive · top 1,000 on PyPI