{"id":2587,"library":"mitmproxy-rs","title":"mitmproxy-rs","description":"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.","status":"active","version":"0.12.9","language":"en","source_language":"en","source_url":"https://github.com/mitmproxy-rs/mitmproxy-rs","tags":["proxy","networking","rust","async","http","https"],"install":[{"cmd":"pip install mitmproxy-rs","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"Server","correct":"from mitmproxy_rs import Server"},{"note":"The generic `Flow` class was replaced by `HttpFlow` and `TcpFlow` in version 0.12.0.","wrong":"from mitmproxy_rs import Flow","symbol":"HttpFlow","correct":"from mitmproxy_rs import HttpFlow"},{"note":"The generic `Flow` class was replaced by `HttpFlow` and `TcpFlow` in version 0.12.0.","wrong":"from mitmproxy_rs import Flow","symbol":"TcpFlow","correct":"from mitmproxy_rs import TcpFlow"},{"note":"The `Mode` enum was renamed to `ProxyMode` in version 0.10.0.","wrong":"from mitmproxy_rs import Mode","symbol":"ProxyMode","correct":"from mitmproxy_rs import ProxyMode"}],"quickstart":{"code":"import mitmproxy_rs\nimport asyncio\n\nasync def main():\n    # A simple HTTP proxy that logs all requests\n    async with mitmproxy_rs.Server(listen_host=\"127.0.0.1\", listen_port=8080) as server:\n        async for flow in server.run():\n            print(f\"[{flow.request.method}] {flow.request.pretty_url}\")\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n","lang":"python","description":"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."},"warnings":[{"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`.","message":"While 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.","severity":"breaking","affected_versions":"all versions"},{"fix":"Update type hints and instantiations from `Flow` to `HttpFlow` or `TcpFlow` as appropriate. E.g., `flow: HttpFlow` instead of `flow: Flow`.","message":"The generic `Flow` object was split into `HttpFlow` and `TcpFlow` for better type clarity and functionality separation.","severity":"breaking","affected_versions":">=0.12.0"},{"fix":"Replace all instances of `mitmproxy_rs.Proxy(...)` with `mitmproxy_rs.Server(...)`.","message":"The main proxy class was renamed from `Proxy` to `Server` for clearer semantics.","severity":"breaking","affected_versions":">=0.10.0"},{"fix":"Update references from `mitmproxy_rs.Mode` to `mitmproxy_rs.ProxyMode`.","message":"The `Mode` enum for proxy operation was renamed to `ProxyMode`.","severity":"breaking","affected_versions":">=0.10.0"},{"fix":"Ensure your Python environment is version 3.12 or later before installing. Using `pyenv` or virtual environments is recommended for managing Python versions.","message":"The library explicitly requires Python 3.12 or newer due to its Rust binding implementation details.","severity":"gotcha","affected_versions":"all versions"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}