Registry / http-networking / mitmproxy-rs

mitmproxy-rs

JSON →
library0.12.11pypypi✓ verified 24d ago

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-rs
INSTALL
IMPORT
SIG · MITMPROXY-RS
M
mitmproxy-rs
http-networkingpythonv0.12.11
Install
1.8s avg
Import
35ms
Disk
21MB
Pass rate
2/ 10
Env Coverage2 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.12.11 · 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
glibc
py 3.10
✕ build_error
✕ build_error
py 3.11
✕ build_error
✕ build_error
py 3.12
✕ build_error
✓ 1.8s
py 3.13
✕ build_error
✓ 1.8s
py 3.9
✕ build_error
✕ build_error
21MB installed
● package 21MB
Code
Verified usage

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

Stream
from mitmproxy_rs import Stream
from mitmproxy_rs import Server
certs
from mitmproxy_rs import certs
contentviews
from mitmproxy_rs import contentviews

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.

import mitmproxy_rs import asyncio async def main(): # A simple HTTP proxy that logs all requests async with mitmproxy_rs.Server(listen_host="127.0.0.1", listen_port=8080) as server: async for flow in server.run(): print(f"[{flow.request.method}] {flow.request.pretty_url}") if __name__ == "__main__": asyncio.run(main())
Debug
Known issues
breakingWhile aiming for API compatibility, `mitmproxy-rs` is a separate implementation. Some APIs, especially for advanced features or internal structures, may diverge from the original `mitmproxy` library.
fix
Always consult the `mitmproxy-rs` documentation for specific API usage. Do not assume direct drop-in replacement without verification, especially when migrating from `mitmproxy`.
affects: all versions
breakingThe generic `Flow` object was split into `HttpFlow` and `TcpFlow` for better type clarity and functionality separation.
fix
Update type hints and instantiations from `Flow` to `HttpFlow` or `TcpFlow` as appropriate. E.g., `flow: HttpFlow` instead of `flow: Flow`.
affects: >=0.12.0
breakingThe main proxy class was renamed from `Proxy` to `Server` for clearer semantics.
fix
Replace all instances of `mitmproxy_rs.Proxy(...)` with `mitmproxy_rs.Server(...)`.
affects: >=0.10.0
breakingThe `Mode` enum for proxy operation was renamed to `ProxyMode`.
fix
Update references from `mitmproxy_rs.Mode` to `mitmproxy_rs.ProxyMode`.
affects: >=0.10.0
gotchaThe library explicitly requires Python 3.12 or newer due to its Rust binding implementation details.
fix
Ensure your Python environment is version 3.12 or later before installing. Using `pyenv` or virtual environments is recommended for managing Python versions.
affects: all versions
Upgrade
Version history
0.12.11latest on PyPI · released Jul 20, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
mitmproxy-rs — pip install mitmproxy-rs · libregistry