mitmproxy-rs is a Python library that re-implements the core functionality of the `mitmproxy` project in Rust, providing a high-performance, async-first HTTP/HTTPS proxy. It offers a largely compatible API for programmatic interception and modification of network traffic, targeting Python 3.12 and newer. As of version 0.12.9, it's under active development with frequent minor releases.
pip install mitmproxy-rsVerified import paths — ran on the pinned version, not inferred.
This example starts a simple HTTP proxy that listens on `127.0.0.1:8080` and prints the method and URL of every intercepted HTTP request. It showcases the `Server` and `HttpFlow` objects.
Always consult the `mitmproxy-rs` documentation for specific API usage. Do not assume direct drop-in replacement without verification, especially when migrating from `mitmproxy`.
Update type hints and instantiations from `Flow` to `HttpFlow` or `TcpFlow` as appropriate. E.g., `flow: HttpFlow` instead of `flow: Flow`.
Replace all instances of `mitmproxy_rs.Proxy(...)` with `mitmproxy_rs.Server(...)`.
Update references from `mitmproxy_rs.Mode` to `mitmproxy_rs.ProxyMode`.
Ensure your Python environment is version 3.12 or later before installing. Using `pyenv` or virtual environments is recommended for managing Python versions.
No dependency data recorded yet.