Rotating MitmProxy
A smart proxy rotator built on mitmproxy that automatically rotates through multiple upstream proxies with health monitoring and failover.
Features
- Smart Proxy Rotation: Round-robin, random, fastest, and smart selection strategies
- Health Monitoring: Real-time proxy health scoring and automatic failover
- High Concurrency: Handles 100+ concurrent requests efficiently
- Multiple Formats: Supports HTTP/SOCKS proxies with authentication
- Web Dashboard: Real-time statistics and monitoring interface
Installation
pip install rotating-mitmproxy
Quick Start
1. Create a proxy list file
# proxy_list.txt
proxy1.example.com:8080
proxy2.example.com:8080
user:pass@proxy3.example.com:8080
socks5://proxy4.example.com:1080
2. Start the proxy server
python -m rotating_mitmproxy --proxy-list proxy_list.txt --port 3129
3. Use the proxy
import requests
proxies = {
'http': 'http://localhost:3129',
'https': 'http://localhost:3129'
}
response = requests.get('https://httpbin.org/ip', proxies=proxies)
print(response.json())
Command Line Options
python -m rotating_mitmproxy [OPTIONS]
Options:
--proxy-list FILE Path to proxy list file (required)
--port PORT Listen port (default: 3129)
--strategy STRATEGY Selection strategy: round-robin, random, fastest, smart (default: smart)
--health-check Enable health checking (default: enabled)
--web-port PORT Web dashboard port (default: 8081, 0 to disable)
--verbose LEVEL Verbosity: quiet, normal, verbose (default: normal)
Proxy List Format
The proxy list file supports multiple formats:
# HTTP proxies
proxy1.example.com:8080
user:pass@proxy2.example.com:8080
# SOCKS proxies
socks5://proxy3.example.com:1080
socks5://user:pass@proxy4.example.com:1080
# With protocol specification
http://proxy5.example.com:8080
https://proxy6.example.com:8080
Selection Strategies
- round-robin: Cycles through proxies in order
- random: Selects proxies randomly
- fastest: Prefers proxies with lowest response times
- smart: Combines health scoring with performance metrics (recommended)
Web Dashboard
Access the web dashboard at http://localhost:8081 to view:
- Real-time proxy statistics
- Health scores and response times
- Success/failure rates
- Active connections
Programmatic Usage
from rotating_mitmproxy import RotatingProxy
# Start proxy server
proxy = RotatingProxy(
proxy_list_file="proxy_list.txt",
port=3129,
strategy="smart"
)
proxy.start()
# Use with requests
import requests
proxies = {'http': 'http://localhost:3129', 'https': 'http://localhost:3129'}
response = requests.get('https://httpbin.org/ip', proxies=proxies)
# Stop server
proxy.stop()
Health Monitoring
The system automatically monitors proxy health by:
- Tracking response times and success rates
- Scoring proxies based on performance
- Temporarily disabling failed proxies
- Gradually re-enabling recovered proxies
Configuration
Environment variables:
export ROTATING_PROXY_LIST="proxy_list.txt"
export ROTATING_PROXY_PORT="3129"
export ROTATING_PROXY_STRATEGY="smart"
export ROTATING_PROXY_WEB_PORT="8081"
Testing
# Run tests
python -m pytest tests/ -v
# Test with example
python examples/basic_example.py
License
MIT License - see LICENSE file for details.
Metadata
Release files for rotating-mitmproxy 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| rotating_mitmproxy-1.3.0.tar.gz | 25.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rotating_mitmproxy-1.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 50.9 kB
Release files / rotating_mitmproxy-1.3.0.tar.gz
| Download URL | rotating_mitmproxy-1.3.0.tar.gz |
|---|---|
| Size | 25.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
70c51ef1ca61b24b956b3b5ae7ce73459d77322dc008f8d341d25e994ed184a3
|
|
BLAKE2b-256 checksum How to use checksums |
af5b44fd15921846e6970b9d8e15d2c45e3d8e9ac639e34a918d13c08d3cc688
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / rotating_mitmproxy-1.3.0-py3-none-any.whl
| Download URL | rotating_mitmproxy-1.3.0-py3-none-any.whl |
|---|---|
| Size | 25.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad66eeae570ae3326c739269e7d3ee299560d313f002e6c74259d8d1000739ce
|
|
BLAKE2b-256 checksum How to use checksums |
b2934a64adb097e407b358092f99848d71ff91a6215581f8f9b78a20593a1fa7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Security for rotating-mitmproxy 1.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.