Registry / http-networking / proxy-py

proxy-py

JSON →
library2.4.10pypypi✓ verified 85d ago

Proxy.py is a lightweight, dependency-optional, and pluggable framework for building fast proxy servers, web servers, and pub/sub systems. It supports HTTP, HTTPS, TLS interception, DNS-over-HTTPS, and can function as a reverse or forward proxy. Currently at version 2.4.10, the library maintains an active release cadence with frequent updates and new features.

pip install proxy.py
INSTALL
IMPORT
SIG · PROXY-PY
P
proxy-py
http-networkingpythonv2.4.10
Install
1.7s avg
Import
Disk
18MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.4.10 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.940 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.7MB
glibc
py 3.103.940 runs
installs and imports cleanly · install 1.7s · import 0.000s · 20MB
18MB installed
● package 18MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Proxy
from proxy import Proxy
from proxy.py import Proxy

This quickstart demonstrates how to programmatically start a basic HTTP forward proxy on `127.0.0.1:8899` using `proxy.py`. The `Proxy.main()` method is used with a list of arguments, mimicking command-line input. The `with` statement ensures proper resource management. The `time.sleep` loop keeps the main thread alive while the proxy runs in its own threads, allowing it to handle requests until a `KeyboardInterrupt` (Ctrl+C) is received.

import os from proxy.py import Proxy if __name__ == '__main__': # Example: Run a basic HTTP proxy on localhost:8899 args = [ '--hostname', '127.0.0.1', '--port', '8899', '--num-workers', '1', # For a simple quickstart '--disable-web-server', # Disable built-in web server if only proxy is needed '--plugins', 'proxy.py.http.proxy.HttpProxyPlugin' # Explicitly enable HTTP proxy ] print(f"Starting HTTP proxy on 127.0.0.1:8899...") print("Use Ctrl+C to stop.") try: # Proxy.main() takes arguments similar to command-line execution with Proxy.main(args): # The proxy runs in separate worker threads within the context manager. # Keep the main thread alive to allow the proxy to run. import time while True: time.sleep(1) except KeyboardInterrupt: print("\nProxy stopped.") except Exception as e: print(f"An error occurred: {e}")
proxy --version
Debug
Known issues
deprecatedUsage of `ssl.wrap_socket` is deprecated in favor of `SSLContext.wrap_socket` for better security and future compatibility.
fix
If implementing custom SSL handling, migrate to `SSLContext.wrap_socket`. The library's internal components generally handle this automatically in recent versions.
affects: >=2.4.7
gotchaTLS (HTTPS) interception requires the `cryptography` Python package and a functional `openssl` command-line utility in your system's PATH. Certificate management (generating root CA, signing server certificates) is also crucial and must be properly configured.
fix
Ensure `pip install proxy.py[tls]` is used. Verify `openssl` is installed and accessible. For production, manage certificates securely and consider the `--insecure-tls-interception` flag only for development/testing.
affects: All versions
gotchaThe library heavily relies on a pluggable architecture. To implement custom logic (e.g., modifying requests, logging, authentication), you must create and register plugins correctly. Misconfigured or missing plugins can lead to unexpected proxy behavior or unhandled requests.
fix
Familiarize yourself with the plugin API (e.g., `HttpProxyPlugin`, `WebServerPlugin`, `GroutPlugin`). Ensure plugins are listed correctly in the `--plugins` argument or passed programmatically when initializing `Proxy`.
affects: All versions
gotchaThe Grout feature, which offers ngrok-like functionality for exposing local services, requires specific configuration and understanding of its tunneling mechanics. Improper setup can expose services insecurely or fail to establish tunnels.
fix
Review the Grout documentation thoroughly. Ensure correct hostnames, ports, and (if applicable) authentication are configured. Be mindful of security implications when exposing local services to the internet.
affects: >=2.4.4
gotchaMany features (e.g., dashboard, metrics, SSH proxy) are gated behind optional `extras` during installation. If functionality is missing or imports fail, it's often due to not installing the required extras.
fix
Always install with the necessary extras, e.g., `pip install proxy.py[dashboard,tls]`, to ensure all desired features and their dependencies are available.
affects: All versions
Upgrade
Version history
2.4.10latest on PyPI · released Feb 18, 2025
Audit
Dependencies
cryptographyoptionalRequired for TLS interception, dashboard, and HTTP metrics features. Installed with '[tls]', '[dashboard]', '[http-metrics]' extras.
OpenSSLoptionalSystem-level OpenSSL utility is required for TLS interception to generate certificates. The 'openssl' executable must be in your PATH or specified via `--openssl` flag.
paramikooptionalRequired for SSH/SFTP proxying capabilities. Installed with '[ssh]' extra.
Agent activity
16 hits · last 30 days
node
14
Amazon
1
Resources
proxy-py — pip install proxy-py · libregistry