# 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
```bash
pip install rotating-mitmproxy
```
## Quick Start
### 1. Create a proxy list file
```text
# 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
```bash
python -m rotating_mitmproxy --proxy-list proxy_list.txt --port 3129
```
### 3. Use the proxy
```python
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
```bash
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:
```text
# 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
```python
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:
```bash
export ROTATING_PROXY_LIST="proxy_list.txt"
export ROTATING_PROXY_PORT="3129"
export ROTATING_PROXY_STRATEGY="smart"
export ROTATING_PROXY_WEB_PORT="8081"
```
## Testing
```bash
# Run tests
python -m pytest tests/ -v
# Test with example
python examples/basic_example.py
```
## License
MIT License - see LICENSE file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "rotating-mitmproxy",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "importal <xychen@msn.com>",
"keywords": "proxy, mitmproxy, rotation, load-balancing, web-scraping, http-proxy, proxy-server",
"author": null,
"author_email": "importal <xychen@msn.com>",
"download_url": "https://files.pythonhosted.org/packages/5a/82/83d4472f11021032e395b2c9ab9f29296bc88a81150a696ae7d54e9d44a6/rotating_mitmproxy-1.2.0.tar.gz",
"platform": null,
"description": "# Rotating MitmProxy\n\nA smart proxy rotator built on mitmproxy that automatically rotates through multiple upstream proxies with health monitoring and failover.\n\n## Features\n\n- **Smart Proxy Rotation**: Round-robin, random, fastest, and smart selection strategies\n- **Health Monitoring**: Real-time proxy health scoring and automatic failover\n- **High Concurrency**: Handles 100+ concurrent requests efficiently\n- **Multiple Formats**: Supports HTTP/SOCKS proxies with authentication\n- **Web Dashboard**: Real-time statistics and monitoring interface\n\n## Installation\n\n```bash\npip install rotating-mitmproxy\n```\n\n## Quick Start\n\n### 1. Create a proxy list file\n\n```text\n# proxy_list.txt\nproxy1.example.com:8080\nproxy2.example.com:8080\nuser:pass@proxy3.example.com:8080\nsocks5://proxy4.example.com:1080\n```\n\n### 2. Start the proxy server\n\n```bash\npython -m rotating_mitmproxy --proxy-list proxy_list.txt --port 3129\n```\n\n### 3. Use the proxy\n\n```python\nimport requests\n\nproxies = {\n 'http': 'http://localhost:3129',\n 'https': 'http://localhost:3129'\n}\n\nresponse = requests.get('https://httpbin.org/ip', proxies=proxies)\nprint(response.json())\n```\n\n## Command Line Options\n\n```bash\npython -m rotating_mitmproxy [OPTIONS]\n\nOptions:\n --proxy-list FILE Path to proxy list file (required)\n --port PORT Listen port (default: 3129)\n --strategy STRATEGY Selection strategy: round-robin, random, fastest, smart (default: smart)\n --health-check Enable health checking (default: enabled)\n --web-port PORT Web dashboard port (default: 8081, 0 to disable)\n --verbose LEVEL Verbosity: quiet, normal, verbose (default: normal)\n```\n\n## Proxy List Format\n\nThe proxy list file supports multiple formats:\n\n```text\n# HTTP proxies\nproxy1.example.com:8080\nuser:pass@proxy2.example.com:8080\n\n# SOCKS proxies \nsocks5://proxy3.example.com:1080\nsocks5://user:pass@proxy4.example.com:1080\n\n# With protocol specification\nhttp://proxy5.example.com:8080\nhttps://proxy6.example.com:8080\n```\n\n## Selection Strategies\n\n- **round-robin**: Cycles through proxies in order\n- **random**: Selects proxies randomly\n- **fastest**: Prefers proxies with lowest response times\n- **smart**: Combines health scoring with performance metrics (recommended)\n\n## Web Dashboard\n\nAccess the web dashboard at `http://localhost:8081` to view:\n\n- Real-time proxy statistics\n- Health scores and response times\n- Success/failure rates\n- Active connections\n\n## Programmatic Usage\n\n```python\nfrom rotating_mitmproxy import RotatingProxy\n\n# Start proxy server\nproxy = RotatingProxy(\n proxy_list_file=\"proxy_list.txt\",\n port=3129,\n strategy=\"smart\"\n)\n\nproxy.start()\n\n# Use with requests\nimport requests\nproxies = {'http': 'http://localhost:3129', 'https': 'http://localhost:3129'}\nresponse = requests.get('https://httpbin.org/ip', proxies=proxies)\n\n# Stop server\nproxy.stop()\n```\n\n## Health Monitoring\n\nThe system automatically monitors proxy health by:\n\n- Tracking response times and success rates\n- Scoring proxies based on performance\n- Temporarily disabling failed proxies\n- Gradually re-enabling recovered proxies\n\n## Configuration\n\nEnvironment variables:\n\n```bash\nexport ROTATING_PROXY_LIST=\"proxy_list.txt\"\nexport ROTATING_PROXY_PORT=\"3129\"\nexport ROTATING_PROXY_STRATEGY=\"smart\"\nexport ROTATING_PROXY_WEB_PORT=\"8081\"\n```\n\n## Testing\n\n```bash\n# Run tests\npython -m pytest tests/ -v\n\n# Test with example\npython examples/basic_example.py\n```\n\n## License\n\nMIT License - see LICENSE file for details.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Smart proxy rotator built on mitmproxy with health monitoring and failover",
"version": "1.2.0",
"project_urls": {
"Bug Tracker": "https://github.com/xychenmsn/rotating-mitmproxy/issues",
"Changelog": "https://github.com/xychenmsn/rotating-mitmproxy/blob/main/CHANGELOG.md",
"Documentation": "https://github.com/xychenmsn/rotating-mitmproxy#readme",
"Homepage": "https://github.com/xychenmsn/rotating-mitmproxy",
"Repository": "https://github.com/xychenmsn/rotating-mitmproxy"
},
"split_keywords": [
"proxy",
" mitmproxy",
" rotation",
" load-balancing",
" web-scraping",
" http-proxy",
" proxy-server"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "bfc06685c0a1788c61f008cb9ec7d0053a2eb3e1068873cfee09ca0c686bec42",
"md5": "b6d32fa73db0cbaead02a60ea9637bf1",
"sha256": "91a8b67f36061bc29956b55ee05b7e1b4db4b5cea6d2a8c45370bdd07ca220d7"
},
"downloads": -1,
"filename": "rotating_mitmproxy-1.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b6d32fa73db0cbaead02a60ea9637bf1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 23755,
"upload_time": "2025-09-01T16:06:38",
"upload_time_iso_8601": "2025-09-01T16:06:38.001172Z",
"url": "https://files.pythonhosted.org/packages/bf/c0/6685c0a1788c61f008cb9ec7d0053a2eb3e1068873cfee09ca0c686bec42/rotating_mitmproxy-1.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "5a8283d4472f11021032e395b2c9ab9f29296bc88a81150a696ae7d54e9d44a6",
"md5": "c03a9e217e283f5da7ab780d084cb186",
"sha256": "cf15853b8c95ff4f20fcb92065cd645412ebfab6aae3f75f7a79645ede4ed724"
},
"downloads": -1,
"filename": "rotating_mitmproxy-1.2.0.tar.gz",
"has_sig": false,
"md5_digest": "c03a9e217e283f5da7ab780d084cb186",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 24087,
"upload_time": "2025-09-01T16:06:39",
"upload_time_iso_8601": "2025-09-01T16:06:39.027463Z",
"url": "https://files.pythonhosted.org/packages/5a/82/83d4472f11021032e395b2c9ab9f29296bc88a81150a696ae7d54e9d44a6/rotating_mitmproxy-1.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-01 16:06:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "xychenmsn",
"github_project": "rotating-mitmproxy",
"github_not_found": true,
"lcname": "rotating-mitmproxy"
}