diff --git a/.github/workflows/proxy_integration_tests.yml b/.github/workflows/proxy_integration_tests.yml
index 9c47638..c741938 100644
--- a/.github/workflows/proxy_integration_tests.yml
+++ b/.github/workflows/proxy_integration_tests.yml
@@ -1,7 +1,11 @@
-# Integration tests against a real proxy (PROXY_URL). Add repository secret PROXY_URL
-# under Settings → Secrets and variables → Actions, then mark this workflow as a required
-# status check under branch protection (pull_request events only receive secrets for PRs
-# from the same repository, not from forks).
+# Pull-request checks.
+# - unit: Python 3.10 and 3.15, client extras, header tests, the httpx guard,
+# and private-hook checks (no PROXY_URL).
+# - integration: real proxy via the PROXY_URL secret. pull_request events only
+# receive secrets for PRs from this repository, not from forks. Add PROXY_URL
+# under Settings → Secrets and variables → Actions, and mark this workflow as
+# a required status check under branch protection.
+# Runners are ubuntu-24.04. Do not switch these jobs to ubuntu-latest.
name: Proxy integration tests
@@ -14,6 +18,10 @@ permissions:
jobs:
unit:
runs-on: ubuntu-24.04
+ strategy:
+ fail-fast: false
+ matrix:
+ python-version: ["3.10", "3.15"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
@@ -22,20 +30,22 @@ jobs:
- name: Set up Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
- python-version: "3.x"
+ python-version: ${{ matrix.python-version }}
- name: Install system dependencies (pycurl)
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
- - name: Install package and test dependencies
+ - name: Install package and compatible client extras
run: |
python -m pip install --upgrade pip
- pip install -e .
- pip install urllib3 requests aiohttp httpx pycurl
+ pip install -e ".[urllib3,requests,httpx,aiohttp,pycurl,cloudscraper,autoscraper]"
- name: Run header security and httpx guard tests
run: python test_header_security.py && python test_httpx_guard.py
+ - name: Run private-hook tests
+ run: python test_client_internals.py
+
integration:
runs-on: ubuntu-24.04
@@ -47,16 +57,15 @@ jobs:
- name: Set up Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
- python-version: "3.x"
+ python-version: "3.15"
- name: Install system dependencies (pycurl)
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
- - name: Install package and test dependencies
+ - name: Install package and compatible client extras
run: |
python -m pip install --upgrade pip
- pip install -e .
- pip install urllib3 requests aiohttp httpx cloudscraper autoscraper pycurl
+ pip install -e ".[urllib3,requests,httpx,aiohttp,pycurl,cloudscraper,autoscraper]"
- name: Require PROXY_URL Actions secret
env:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 94401c5..3e3db75 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,9 @@
## Unreleased
- Importing `python_proxy_headers.httpx_proxy` on httpx >= 1 raises `ImportError`. httpx 1.0 removed proxy support. The `[httpx]` extra is `httpx>=0.28,<1`.
+- Optional extras pin the client ranges CI installs: `[urllib3]`, `[requests]`, `[httpx]`, `[aiohttp]`, `[pycurl]`, `[cloudscraper]`, and `[autoscraper]`.
+- `requires-python` is `>=3.10`. Python 3.8 and 3.9 are no longer supported. Those clients require 3.10+, and the httpx adapter already uses `str | None`.
+- Keywords, trove classifiers, and the changelog URL now point at this file.
## 0.2.4 - 2026-11-09
diff --git a/README.md b/README.md
index dc08423..10dacc4 100644
--- a/README.md
+++ b/README.md
@@ -33,9 +33,21 @@ This library solves both problems for popular Python HTTP libraries.
pip install python-proxy-headers
```
-Then install the HTTP library you want to use (e.g., `pip install requests`).
+Or install the client extra you need. Each extra pins a range that CI tests:
-> **Note:** This package has no dependencies by default - install only what you need.
+```bash
+pip install 'python-proxy-headers[requests]'
+pip install 'python-proxy-headers[urllib3]'
+pip install 'python-proxy-headers[httpx]'
+pip install 'python-proxy-headers[aiohttp]'
+pip install 'python-proxy-headers[pycurl]'
+pip install 'python-proxy-headers[cloudscraper]'
+pip install 'python-proxy-headers[autoscraper]'
+```
+
+The `httpx` extra is `httpx>=0.28,<1`. Importing `python_proxy_headers.httpx_proxy` on httpx 1.x raises `ImportError`. See the [httpx docs](https://python-proxy-headers.readthedocs.io/en/latest/httpx.html). Proxy header names are specific to your provider; ProxyMesh documents theirs at [docs.proxymesh.com](https://docs.proxymesh.com/).
+
+> **Note:** This package has no required dependencies. Install only the extra you need.
## Quick Start
@@ -122,6 +134,11 @@ response = scraper.get('https://example.com')
A test harness is included to verify proxy header functionality:
```bash
+# Header checks and private-hook checks (no proxy credentials)
+python test_header_security.py
+python test_httpx_guard.py
+python test_client_internals.py
+
# Set your proxy
export PROXY_URL='http://user:pass@proxy.example.com:8080'
@@ -142,8 +159,10 @@ For detailed documentation, API reference, and more examples:
- **Full Documentation:** [python-proxy-headers.readthedocs.io](https://python-proxy-headers.readthedocs.io/en/latest/)
- **Example Code:** [proxy-examples for Python](https://github.com/proxymesh/proxy-examples/tree/main/python)
-## Related Projects
+## Other languages
+- **[javascript-proxy-headers](https://github.com/proxymesh/javascript-proxy-headers)** - Send and read custom proxy headers on HTTPS CONNECT for Node.js HTTP clients
+- **[ruby-proxy-headers](https://github.com/proxymesh/ruby-proxy-headers)** - Send and read custom proxy headers on HTTPS CONNECT for Ruby HTTP clients
- **[scrapy-proxy-headers](https://github.com/proxymesh/scrapy-proxy-headers)** - Proxy header support for Scrapy
## About
diff --git a/docs/index.rst b/docs/index.rst
index a8cca37..25c2ffa 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -25,20 +25,27 @@ None of these modules provide good support for parsing custom response headers f
If you are looking for `Scrapy `_ support, please see our `scrapy-proxy-headers `_ project.
+The same CONNECT header support in other languages:
+
+* `javascript-proxy-headers `_
+* `ruby-proxy-headers `_
+
Installation
------------
To use these extension modules, you must first do the following:
-1. Install the package:
+1. Install the package, optionally with the client you use:
.. code-block:: bash
pip install python-proxy-headers
+ pip install 'python-proxy-headers[requests]'
+ pip install 'python-proxy-headers[httpx]'
-2. Install the appropriate package based on the Python module you want to use.
+2. Or install the HTTP library yourself. Extras pin the ranges we test. The ``httpx`` extra is ``httpx>=0.28,<1``. Importing it on httpx 1.x raises ``ImportError``; see :doc:`httpx`. Proxy-specific headers are documented by your provider. ProxyMesh's are at `docs.proxymesh.com `_.
-This package does not have any dependencies because we don't know which module you want to use.
+This package does not have any required dependencies because we don't know which module you want to use.
You can also find more example code in our `proxy-examples for python `_.
diff --git a/pyproject.toml b/pyproject.toml
index f01e15c..f8169e3 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -10,22 +10,54 @@ authors = [
]
description = "Handle custom proxy headers for http & https requests in various python libraries"
readme = "README.md"
-requires-python = ">=3.8"
+requires-python = ">=3.10"
+keywords = [
+ "proxy",
+ "proxy-headers",
+ "https-proxy",
+ "connect",
+ "tunnel",
+ "requests",
+ "urllib3",
+ "httpx",
+ "aiohttp",
+ "web-scraping",
+ "proxymesh",
+]
classifiers = [
+ "Development Status :: 4 - Beta",
"Programming Language :: Python :: 3",
+ "Programming Language :: Python :: 3 :: Only",
+ "Programming Language :: Python :: 3.10",
+ "Programming Language :: Python :: 3.11",
+ "Programming Language :: Python :: 3.12",
+ "Programming Language :: Python :: 3.13",
+ "Programming Language :: Python :: 3.14",
+ "Programming Language :: Python :: 3.15",
"Operating System :: OS Independent",
- "License :: OSI Approved :: MIT License",
- "Intended Audience :: Developers",
- "Topic :: Internet :: WWW/HTTP",
+ "License :: OSI Approved :: MIT License",
+ "Intended Audience :: Developers",
+ "Topic :: Internet :: WWW/HTTP",
+ "Topic :: Internet :: Proxy Servers",
"Topic :: Software Development :: Libraries :: Python Modules",
+ "Framework :: AsyncIO",
]
+# Lower bounds are the oldest minor whose private hooks still match the
+# adapters. CI installs the newest release inside each range. httpx 1.x is
+# excluded: 1.0.dev6 drops httpcore and proxy support (encode/httpx#947).
[project.optional-dependencies]
+urllib3 = ["urllib3>=2.2,<3"]
+requests = ["requests>=2.31,<3"]
httpx = ["httpx>=0.28,<1"]
+aiohttp = ["aiohttp>=3.10,<4"]
+pycurl = ["pycurl>=7.45,<8"]
+cloudscraper = ["cloudscraper>=1.2.71,<2"]
+autoscraper = ["autoscraper>=1.1.14,<2"]
[project.urls]
Homepage = "https://github.com/proxymesh/python-proxy-headers"
-Changelog = "https://github.com/proxymesh/python-proxy-headers/commits/main/"
+Changelog = "https://github.com/proxymesh/python-proxy-headers/blob/main/CHANGELOG.md"
Issues = "https://github.com/proxymesh/python-proxy-headers/issues"
Documentation = "https://python-proxy-headers.readthedocs.io/en/latest/"
ProxyMesh = "https://proxymesh.com"
diff --git a/test_client_internals.py b/test_client_internals.py
new file mode 100644
index 0000000..ada7a5e
--- /dev/null
+++ b/test_client_internals.py
@@ -0,0 +1,86 @@
+"""The private hooks this package overrides are still present upstream."""
+
+import http.client
+import inspect
+import sys
+import unittest
+
+from aiohttp.connector import TCPConnector
+from httpcore._async.http_proxy import AsyncHTTPProxy, AsyncTunnelHTTPConnection
+from httpcore._sync.http_proxy import HTTPProxy, TunnelHTTPConnection
+from urllib3.connectionpool import HTTPSConnectionPool
+
+from python_proxy_headers.aiohttp_proxy import ProxyTCPConnector
+from python_proxy_headers.httpx_proxy import (
+ AsyncHTTPProxyHeaders,
+ AsyncProxyTunnelHTTPConnection,
+ HTTPProxyHeaders,
+ ProxyTunnelHTTPConnection,
+)
+from python_proxy_headers.urllib3_proxy_manager import (
+ HTTPSProxyConnection,
+ HTTPSProxyConnectionPool,
+)
+
+
+class HookTests(unittest.TestCase):
+ def test_urllib3_prepare_proxy(self) -> None:
+ self.assertIsNot(
+ HTTPSProxyConnectionPool._prepare_proxy,
+ HTTPSConnectionPool._prepare_proxy,
+ )
+ self.assertEqual(
+ list(inspect.signature(HTTPSProxyConnectionPool._prepare_proxy).parameters),
+ list(inspect.signature(HTTPSConnectionPool._prepare_proxy).parameters),
+ )
+ self.assertTrue(callable(http.client._read_headers))
+ if sys.version_info < (3, 12):
+ self.assertTrue(callable(HTTPSProxyConnection._tunnel))
+ else:
+ self.assertTrue(callable(http.client.HTTPConnection._tunnel))
+ self.assertTrue(
+ callable(http.client.HTTPConnection.get_proxy_response_headers)
+ )
+
+ def test_httpx_handle_request(self) -> None:
+ self.assertIsNot(
+ ProxyTunnelHTTPConnection.handle_request,
+ TunnelHTTPConnection.handle_request,
+ )
+ self.assertIsNot(
+ AsyncProxyTunnelHTTPConnection.handle_async_request,
+ AsyncTunnelHTTPConnection.handle_async_request,
+ )
+ self.assertIsNot(
+ HTTPProxyHeaders.create_connection,
+ HTTPProxy.create_connection,
+ )
+ self.assertIsNot(
+ AsyncHTTPProxyHeaders.create_connection,
+ AsyncHTTPProxy.create_connection,
+ )
+ params = inspect.signature(TunnelHTTPConnection.__init__).parameters
+ for name in (
+ "proxy_origin",
+ "remote_origin",
+ "ssl_context",
+ "proxy_ssl_context",
+ "proxy_headers",
+ "keepalive_expiry",
+ "http1",
+ "http2",
+ "network_backend",
+ ):
+ self.assertIn(name, params)
+
+ def test_aiohttp_create_proxy_connection(self) -> None:
+ self.assertEqual(
+ list(
+ inspect.signature(ProxyTCPConnector._create_proxy_connection).parameters
+ ),
+ list(inspect.signature(TCPConnector._create_proxy_connection).parameters),
+ )
+
+
+if __name__ == "__main__":
+ unittest.main()