CLI Reference¶
ProxyWhirl provides a full-featured command-line interface for proxy rotation, pool management, health monitoring, statistics, and data export. All commands support multiple output formats (text/JSON/CSV) and integrate with the configuration system.
Installation¶
# Install with CLI support
uv pip install proxywhirl
# Or install from source
uv sync
uv run proxywhirl --help
Global Options¶
All commands support these global options:
Option |
Default |
Description |
|---|---|---|
|
Auto-discover |
Path to TOML configuration file |
|
|
Output format: |
|
|
Enable verbose logging and debug output |
|
|
Disable file locking (use with caution in concurrent scenarios) |
Config Auto-Discovery¶
When --config is not provided, ProxyWhirl searches for configuration in this order:
Project directory:
./pyproject.toml(requires[tool.proxywhirl]section)User directory:
~/.config/proxywhirl/config.toml(Linux/macOS) or%APPDATA%\proxywhirl\config.toml(Windows)Defaults: In-memory configuration with sensible defaults
Tip
Use proxywhirl config init to create a starter configuration file (.proxywhirl.toml) in the current directory. To use project-local auto-discovery, add a [tool.proxywhirl] section to your pyproject.toml instead. For user-global configuration, place your config at ~/.config/proxywhirl/config.toml. See Configuration Reference for a complete list of all configurable keys.
Commands¶
request¶
Make HTTP requests through rotating proxies with automatic retry and failover.
Usage:
proxywhirl request [OPTIONS] URL
Arguments:
URL: Target URL to request (required)
Options:
Option |
Default |
Description |
|---|---|---|
|
|
HTTP method (GET, POST, PUT, DELETE, etc.) |
|
None |
Custom headers (format: |
|
None |
Request body data (JSON string or form data) |
|
None |
Override rotation and use specific proxy URL |
|
|
Maximum retry attempts (overrides config) |
|
|
Allow requests to localhost/private IPs (use with caution) |
Examples:
# Simple GET request
proxywhirl request https://api.example.com/data
# POST with JSON data
proxywhirl request -X POST -d '{"key":"value"}' https://api.example.com/submit
# Custom headers
proxywhirl request -H "Authorization: Bearer token123" \
-H "User-Agent: CustomBot/1.0" \
https://api.example.com/protected
# Force specific proxy
proxywhirl request --proxy http://proxy.example.com:8080 https://httpbin.org/ip
# JSON output for parsing
proxywhirl --format json request https://api.example.com/data
Output (text format):
Status: 200
URL: https://api.example.com/data
Time: 245ms
Proxy: http://proxy1.example.com:8080
Attempts: 1
Response:
{"result": "success", "data": [...]}
Output (JSON format):
{
"status_code": 200,
"url": "https://api.example.com/data",
"method": "GET",
"elapsed_ms": 245.3,
"proxy_used": "http://proxy1.example.com:8080",
"attempts": 1,
"body": "{\"result\": \"success\"}"
}
pool¶
Manage the proxy pool: list proxies, add new ones, remove proxies, or test connectivity.
Usage:
proxywhirl pool [OPTIONS] ACTION [PROXY]
Arguments:
ACTION: Action to perform:list,add,remove, ortestPROXY: Proxy URL (required foradd,remove,testactions)
Options:
Option |
Default |
Description |
|---|---|---|
|
None |
Proxy authentication username (for |
|
None |
Proxy authentication password (for |
|
|
Target URL for proxy testing (http/https only) |
|
|
Allow testing against localhost/private IPs (use with caution) |
Examples:
# List all proxies in pool
proxywhirl pool list
# List with JSON output
proxywhirl --format json pool list
# Add proxy without authentication
proxywhirl pool add http://proxy1.example.com:8080
# Add proxy with authentication
proxywhirl pool add http://proxy2.example.com:8080 \
--username myuser \
--password mypass
# Remove proxy
proxywhirl pool remove http://proxy1.example.com:8080
# Test proxy connectivity
proxywhirl pool test http://proxy1.example.com:8080
# Test proxy with custom target URL
proxywhirl pool test http://proxy1.example.com:8080 \
--target-url https://api.example.com
Output (list, text format):
Proxy Pool Summary
Total Proxies: 3
Healthy: 2 | Degraded: 1 | Failed: 0
Strategy: round-robin
● http://proxy1.example.com:8080 (145ms, 98% success)
● http://proxy2.example.com:8080 (230ms, 95% success)
● http://proxy3.example.com:8080 (1245ms, 67% success)
Output (test, text format):
Testing proxy: http://proxy1.example.com:8080...
Target URL: https://httpbin.org/ip
✓ Proxy is working (145ms)
Warning
Proxies added via pool add are persisted to your configuration file. Use --config to specify which config file to update.
Note
The --allow-private flag bypasses SSRF protection. Only use it when testing against trusted local/internal services.
config¶
Manage CLI configuration: show current settings, get/set individual values, or initialize a new config file.
Usage:
proxywhirl config ACTION [KEY] [VALUE]
Arguments:
ACTION: Action to perform:show,get,set, orinitKEY: Configuration key (forget/setactions)VALUE: Configuration value (forsetaction)
Examples:
# Initialize new config file
proxywhirl config init
# Show entire configuration
proxywhirl config show
# Show config as JSON
proxywhirl --format json config show
# Get specific setting
proxywhirl config get rotation_strategy
# Set rotation strategy
proxywhirl config set rotation_strategy random
# Set timeout
proxywhirl config set timeout 60
# Set boolean values
proxywhirl config set verify_ssl false
Configurable Keys:
Key |
Type |
Default |
Description |
|---|---|---|---|
|
str |
|
Proxy rotation strategy ( |
|
int |
|
Seconds between health checks (0 to disable) |
|
int |
|
Request timeout in seconds |
|
int |
|
Maximum retry attempts per request |
|
bool |
|
Follow HTTP redirects automatically |
|
bool |
|
Verify SSL certificates |
|
str |
|
Default output format |
|
bool |
|
Enable colored terminal output |
|
bool |
|
Enable verbose logging |
|
str |
|
Storage backend type |
|
path or null |
|
Path for file/sqlite storage |
|
bool |
|
Encrypt credentials in config file |
|
str |
|
Environment variable name for encryption key |
Output (show, text format):
Configuration
Config file: /Users/user/project/pyproject.toml
rotation_strategy: round-robin
health_check_interval: 300s
timeout: 30s
max_retries: 3
follow_redirects: True
verify_ssl: True
default_format: text
color: True
verbose: False
storage_backend: file
storage_path: None
health¶
Check health of all proxies in the pool. Supports continuous monitoring mode for long-running checks.
Usage:
proxywhirl health [OPTIONS]
Options:
Option |
Default |
Description |
|---|---|---|
|
|
Run continuously with periodic checks |
|
Config value |
Check interval in seconds (for continuous mode; falls back to |
|
None |
Target URL for health checks (http/https only; falls back to |
|
|
Allow testing against localhost/private IPs (use with caution) |
Examples:
# Single health check
proxywhirl health
# Continuous monitoring with config interval
proxywhirl health -C
# Continuous monitoring with custom interval
proxywhirl health -C --interval 60
# Health check with custom target URL
proxywhirl health --target-url https://api.example.com
# Health check with JSON output
proxywhirl --format json health
Output (single check, text format):
Checking proxy health...
Health Check Results
Healthy: 2 | Degraded: 1 | Failed: 0
● http://proxy1.example.com:8080 (145ms, 98% success)
● http://proxy2.example.com:8080 (230ms, 95% success)
● http://proxy3.example.com:8080 (1245ms, 67% success)
Output (continuous mode):
Continuous health monitoring (interval: 60s)
Press Ctrl+C to stop
Check #1
✓ http://proxy1.example.com:8080: 200 (145ms)
✓ http://proxy2.example.com:8080: 200 (230ms)
✗ http://proxy3.example.com:8080: Connection timeout
Status: 2 healthy | 0 degraded | 1 failed
Check #2
✓ http://proxy1.example.com:8080: 200 (152ms)
✓ http://proxy2.example.com:8080: 200 (218ms)
✓ http://proxy3.example.com:8080: 200 (890ms)
Status: 3 healthy | 0 degraded | 0 failed
...
Monitoring stopped
Output (JSON format):
{
"total_proxies": 3,
"healthy": 2,
"degraded": 1,
"failed": 0,
"rotation_strategy": "round-robin",
"current_index": 0,
"proxies": [
{
"url": "http://proxy1.example.com:8080",
"health": "healthy",
"response_time_ms": 145.3,
"success_rate": 0.98
},
{
"url": "http://proxy2.example.com:8080",
"health": "healthy",
"response_time_ms": 230.1,
"success_rate": 0.95
},
{
"url": "http://proxy3.example.com:8080",
"health": "degraded",
"response_time_ms": 1245.6,
"success_rate": 0.67
}
]
}
Note
The --allow-private flag bypasses SSRF protection. Only use it when testing against trusted local/internal services.
fetch¶
Fetch proxies from 60+ free proxy sources, validate them, and save to database and files.
Usage:
proxywhirl fetch [OPTIONS]
Options:
Option |
Default |
Description |
|---|---|---|
|
|
Skip proxy validation |
|
|
Don’t save to database |
|
|
Don’t export to files |
|
|
Validation timeout in seconds |
|
|
Concurrent validation requests |
|
|
Re-validate existing proxies in database instead of fetching new ones |
|
|
Delete failed proxies instead of marking them as DEAD (use with |
Examples:
# Fetch and validate from all sources
proxywhirl fetch
# Fast fetch without validation (raw proxies)
proxywhirl fetch --no-validate
# Custom timeout and concurrency
proxywhirl fetch --timeout 5 --concurrency 50
# Re-validate existing proxies in the database
proxywhirl fetch --revalidate --timeout 5 --concurrency 2000
# Re-validate and delete failed proxies
proxywhirl fetch --revalidate --prune-failed
# Fetch without database save (files only)
proxywhirl fetch --no-save-db
Process:
Fetches proxies from 60+ sources (HTTP, SOCKS4, SOCKS5)
Validates each proxy for connectivity (optional, parallel)
Saves validated proxies to SQLite database (optional)
Exports to text/JSON files for web dashboard (optional)
Enriches with GeoIP metadata when available
Output:
ProxyWhirl Fetch - Aggregating proxies from 60+ sources
Fetching from 45 HTTP sources...
Fetching from 8 SOCKS4 sources...
Fetching from 7 SOCKS5 sources...
Fetched raw proxies: 12,345 trusted (http), 234 trusted (socks4), 567 trusted (socks5)
Untrusted proxies: 45,678 (http), 1,234 (socks4), 2,345 (socks5)
✓ Trusted sources: 13,146 proxies added without validation
Validating 49,257 proxies with concurrency=100...
Progress: 10000/49257 checked, 1234 valid (12.3%), 2000 proxies/sec
Progress: 20000/49257 checked, 2567 valid (12.8%), 2050 proxies/sec
...
✓ Validation complete: 6,789/49,257 valid (13.8%) in 24.3s
Total proxies ready: 19,935
✓ Saved 6,789 http proxies to docs/proxy-lists/http.txt
✓ Saved 234 socks4 proxies to docs/proxy-lists/socks4.txt
✓ Saved 567 socks5 proxies to docs/proxy-lists/socks5.txt
✓ Saved all proxies to docs/proxy-lists/all.txt
✓ Saved JSON to docs/proxy-lists/proxies.json
✓ Saved metadata to docs/proxy-lists/metadata.json
Enriching proxies with metadata...
✓ Enriched 18,456/19,935 proxies with geo data
✓ Saved rich JSON (19,935 proxies) to docs/proxy-lists/proxies-rich.json
✓ Saved 19,935 validated proxies to database: proxywhirl.db
Proxy aggregation complete!
Tip
Use --concurrency 2000 for faster validation on systems with high network capacity. The default is 100. For automated fetching via CI/CD, see Automation & CI/CD Runbook.
export¶
Export proxy data for web dashboards and analytics. Generates stats.json and proxies-rich.json files with full metadata.
Usage:
proxywhirl export [OPTIONS]
Options:
Option |
Default |
Description |
|---|---|---|
|
|
Output directory for exported files |
|
|
Path to SQLite database |
|
|
Only export stats.json |
|
|
Only export proxies-rich.json |
Examples:
# Export all files
proxywhirl export
# Export to custom directory
proxywhirl export --output ./data/exports
# Export only statistics
proxywhirl export --stats-only
# Export from custom database
proxywhirl export --db ./custom.db --output ./output
Output:
Exporting data for web dashboard...
Output directory: docs/proxy-lists
Database: proxywhirl.db
✓ Exported stats: docs/proxy-lists/stats.json
✓ Exported proxies-rich: docs/proxy-lists/proxies-rich.json
Export complete!
Generated Files:
stats.json: Aggregate statistics (total proxies, health distribution, protocol breakdown)proxies-rich.json: Full proxy details with geo data, response times, success rates
Note
The export command is used by CI/CD workflows to generate data for the web dashboard. It aggregates database content and enriches with metadata.
setup-geoip¶
Set up the MaxMind GeoLite2 database for offline geo enrichment of proxy data.
Usage:
proxywhirl setup-geoip [OPTIONS]
Options:
Option |
Default |
Description |
|---|---|---|
|
|
Only check if GeoIP database exists |
Examples:
# Show setup instructions
proxywhirl setup-geoip
# Check if database is installed
proxywhirl setup-geoip --check
Output (when database is missing):
MaxMind GeoLite2 Database Setup
GeoIP database not found.
To enable geo enrichment, download the free GeoLite2-City database:
Option 1: Direct Download (Recommended)
1. Go to: https://www.maxmind.com/en/geolite2/signup
2. Create a free account
3. Download 'GeoLite2-City' in MMDB format
4. Place the file at: ~/.config/proxywhirl/GeoLite2-City.mmdb
Option 2: Using geoipupdate tool
1. Install: brew install geoipupdate # or apt-get install geoipupdate
2. Configure with your MaxMind license key
3. Run: geoipupdate
4. Symlink or copy to: ~/.config/proxywhirl/GeoLite2-City.mmdb
Note: GeoLite2 databases are free but require registration.
Without it, enrichment still provides IP properties and port analysis.
✓ Created config directory: ~/.config/proxywhirl
Output (when database is installed):
✓ GeoIP database is available
Location: ~/.config/proxywhirl/GeoLite2-City.mmdb
Proxy enrichment will include:
• Country name and code
• City and region
• Timezone
• Geographic coordinates
Note
GeoIP enrichment is optional. Without the database, proxywhirl fetch still provides IP properties and port analysis.
sources¶
Command group for listing, validating, and auditing proxy sources. When invoked without a subcommand, lists or validates all configured sources.
Usage:
proxywhirl sources [OPTIONS]
proxywhirl sources audit [OPTIONS]
sources (list/validate)¶
Options:
Option |
Default |
Description |
|---|---|---|
|
|
Validate all sources and check for broken ones |
|
|
Timeout per source in seconds |
|
|
Maximum concurrent requests |
|
|
Exit with error code if any sources are unhealthy (for CI) |
Examples:
# List all sources
proxywhirl sources
# Validate all sources
proxywhirl sources --validate
# Validate with higher concurrency
proxywhirl sources --validate --concurrency 50
# CI mode: fail if sources are unhealthy
proxywhirl sources --validate --fail-on-unhealthy
# Get results as JSON
proxywhirl --format json sources --validate
Output (list mode):
Configured Proxy Sources
HTTP Sources (45):
• https://www.proxy-list.download/api/v1/get?type=http
• https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http
• https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/http.txt
...
SOCKS4 Sources (8):
• https://www.proxy-list.download/api/v1/get?type=socks4
• https://api.proxyscrape.com/v2/?request=displayproxies&protocol=socks4
...
SOCKS5 Sources (7):
• https://www.proxy-list.download/api/v1/get?type=socks5
• https://api.proxyscrape.com/v2/?request=displayproxies&protocol=socks5
...
Total: 60 sources
Use --validate to check source health
Use 'proxywhirl sources audit' for detailed auditing
Output (validate mode):
Validating 60 proxy sources...
┏━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┓
┃ Status ┃ Source ┃ Response ┃ Size ┃ Time ┃ Error ┃
┡━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━┩
│ ✓ OK │ proxy-list.download HTTP │ 200 │ 12,345 │ 234ms │ │
│ ✓ OK │ proxyscrape HTTP │ 200 │ 45,678 │ 456ms │ │
│ ✗ FAIL │ stale-source.example.com │ - │ - │ 0ms │ Timeout│
...
┗━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━┷━━━━━━━━┛
Summary:
Total: 60 | Healthy: 58 | Unhealthy: 2 | Time: 5678ms
Unhealthy sources:
• stale-source.example.com: Timeout
• broken-source.example.com: HTTP 404
Tip
Run proxywhirl sources --validate --fail-on-unhealthy in CI to catch broken sources early.
sources audit¶
Audit proxy sources for broken or stale entries. Tests each source by fetching from it and checking if it returns valid proxies. A source is considered “broken” if it returns a non-200 status, times out after retries, returns fewer proxies than --min-proxies, or returns malformed content.
Usage:
proxywhirl sources audit [OPTIONS]
Options:
Option |
Default |
Description |
|---|---|---|
|
|
Timeout per source in seconds |
|
|
Maximum concurrent requests |
|
|
Number of retries for each source before marking as broken |
|
|
Remove broken sources from |
|
|
Show what would be removed without making changes (implies |
|
|
Minimum proxies required for a source to be considered healthy |
|
None |
Only audit sources of specific protocol ( |
Examples:
# Audit all sources
proxywhirl sources audit
# Only audit HTTP sources
proxywhirl sources audit --protocol http
# Remove broken sources (creates backup)
proxywhirl sources audit --fix
# Preview what would be removed
proxywhirl sources audit --dry-run
# More retries before marking broken
proxywhirl sources audit --retries 5
stats¶
Display retry and circuit breaker statistics for monitoring proxy performance and reliability.
Usage:
proxywhirl stats [OPTIONS]
Options:
Option |
Default |
Description |
|---|---|---|
|
|
Show retry metrics (attempts, success by attempt, etc.) |
|
|
Show circuit breaker state transitions |
|
|
Time window in hours for statistics |
Examples:
# Show retry metrics (default if no flags)
proxywhirl stats --retry
# Show circuit breaker states
proxywhirl stats --circuit-breaker
# Show both retry and circuit breaker stats
proxywhirl stats --retry --circuit-breaker
# Show stats for last 12 hours
proxywhirl stats --retry --circuit-breaker --hours 12
# Get stats as JSON
proxywhirl --format json stats --retry
Output (retry metrics, text format):
Retry Metrics Summary
Total Retries: 1,234
Retention: 24 hours
Success Rate by Attempt:
┏━━━━━━━━━┳━━━━━━━━━━━┓
┃ Attempt ┃ Successes ┃
┡━━━━━━━━━╇━━━━━━━━━━━┩
│ 1 │ 850 │
│ 2 │ 234 │
│ 3 │ 150 │
└─────────┴───────────┘
Per-Proxy Statistics:
┏━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓
┃ Proxy ID ┃ Attempts ┃ Success ┃ Failures ┃ Avg Latency ┃ CB Opens┃
┡━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩
│ proxy1.example.com │ 500 │ 475(95%)│ 25 │ 145ms │ 2 │
│ proxy2.example.com │ 400 │ 360(90%)│ 40 │ 230ms │ 5 │
│ proxy3.example.com │ 334 │ 200(60%)│ 134 │ 1245ms │ 15 │
└──────────────────────┴──────────┴─────────┴──────────┴─────────────┴─────────┘
Output (circuit breaker events, text format):
Circuit Breaker Events
Total Events: 45
Recent Events (last 20):
┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┓
┃ Timestamp ┃ Proxy ID ┃ Transition ┃ Failures ┃
┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━┩
│ 2025-12-27 18:15:23 │ proxy1.example.com │ closed → open │ 5 │
│ 2025-12-27 18:18:45 │ proxy1.example.com │ open → half_open │ 0 │
│ 2025-12-27 18:19:12 │ proxy1.example.com │ half_open → closed │ 0 │
│ 2025-12-27 18:25:30 │ proxy3.example.com │ closed → open │ 8 │
...
└─────────────────────┴──────────────────────┴────────────────────┴──────────┘
Output (JSON format):
{
"summary": {
"total_retries": 1234,
"retention_hours": 24,
"success_by_attempt": {
"1": 850,
"2": 234,
"3": 150
}
},
"by_proxy": {
"proxy1.example.com:8080": {
"total_attempts": 500,
"success_count": 475,
"failure_count": 25,
"avg_latency": 145.3,
"circuit_breaker_opens": 2
}
}
}
Note
The stats command shows both if neither --retry nor --circuit-breaker is specified. For programmatic access to retry metrics and circuit breaker state, see Retry & Failover Guide.
tui¶
Launch the interactive Terminal User Interface (TUI) dashboard for real-time proxy management.
Usage:
proxywhirl tui
The TUI provides a full-featured dashboard with:
Real-time metrics and sparkline visualizations
Proxy table with filtering, sorting, and health status
Manual proxy management (add/remove)
Health checks with progress bars
Circuit breaker monitoring (see Retry & Failover Guide for circuit breaker details)
Request testing with multiple HTTP methods
Export functionality with format preview
Keyboard Shortcuts:
Key |
Action |
|---|---|
|
Navigate up/down |
|
Jump to first/last |
|
View proxy details |
|
Copy proxy URL |
|
Quick test proxy |
|
Focus search |
|
Show help modal |
|
Toggle auto-refresh |
|
Refresh all data |
|
Fetch tab |
|
Export tab |
|
Test tab |
|
Health tab |
Tip
The TUI is an alternative to the CLI commands for users who prefer a visual interface. It uses the same underlying proxy pool and configuration.
db-stats¶
Show comprehensive database statistics including counts by health status, protocol, and validation metrics.
Usage:
proxywhirl db-stats [OPTIONS]
Options:
Option |
Default |
Description |
|---|---|---|
|
|
Path to SQLite database |
Examples:
# Show database statistics
proxywhirl db-stats
# Use custom database path
proxywhirl db-stats --db custom.db
# Get stats as JSON
proxywhirl --format json db-stats
Output (text format):
Proxy Database Statistics
┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ Metric ┃ Value ┃
┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
│ Total Proxies │ 19,935 │
│ │ │
│ By Health Status │ │
│ healthy │ 12,456 │
│ unknown │ 5,234 │
│ dead │ 2,245 │
│ │ │
│ By Protocol │ │
│ http │ 15,678 │
│ socks4 │ 2,345 │
│ socks5 │ 1,912 │
│ │ │
│ Database Size │ 12.34 MB│
└─────────────────────┴───────────┘
cleanup¶
Clean up stale and dead proxies from the database. Performs a dry run by default.
Usage:
proxywhirl cleanup [OPTIONS]
Options:
Option |
Default |
Description |
|---|---|---|
|
|
Path to SQLite database |
|
|
Remove proxies not validated in N days |
|
|
Actually perform cleanup (dry run by default) |
Examples:
# Dry run - shows what would be removed
proxywhirl cleanup
# Actually remove stale proxies
proxywhirl cleanup --execute
# Remove proxies not validated in 14 days
proxywhirl cleanup --stale-days 14 --execute
# Get results as JSON
proxywhirl --format json cleanup --execute
Output (dry run):
Dry run - showing what would be removed:
dead: 2,245
Output (execute):
✓ Cleanup completed: removed 2,245 proxies
dead: 2,245
Tip
Use cleanup in CI/CD pipelines before export to ensure only valid proxies are included. See Automation & CI/CD Runbook for proxy refresh workflows.
Output Formats¶
All commands support three output formats via the --format global option:
Text (default)¶
Human-readable output with colors and formatting. Ideal for interactive terminal use.
proxywhirl pool list
JSON¶
Machine-readable JSON for parsing and automation. Includes all fields with type information.
proxywhirl --format json pool list
CSV¶
Tabular output for spreadsheet import or data analysis. Only available for list/table commands.
proxywhirl --format csv pool list > proxies.csv
Configuration File¶
ProxyWhirl uses TOML configuration files. Example ~/.config/proxywhirl/config.toml:
# Proxy pool
[[proxies]]
url = "http://proxy1.example.com:8080"
[[proxies]]
url = "http://proxy2.example.com:8080"
username = "user"
password = "pass"
# Rotation settings
rotation_strategy = "round-robin"
health_check_interval = 300
# Request settings
timeout = 30
max_retries = 3
follow_redirects = true
verify_ssl = true
# Output settings
default_format = "text"
color = true
verbose = false
# Storage settings
storage_backend = "file"
# Security
encrypt_credentials = true
encryption_key_env = "PROXYWHIRL_KEY"
For project-specific configuration, use pyproject.toml:
[tool.proxywhirl]
rotation_strategy = "random"
timeout = 60
max_retries = 5
[[tool.proxywhirl.proxies]]
url = "http://proxy1.example.com:8080"
See also
Getting Started for the quick start guide
Advanced Rotation Strategies for rotation strategy details
Retry & Failover Guide for retry and circuit breaker configuration
Configuration Reference for complete configuration reference
Advanced Usage¶
Scripting with JSON Output¶
#!/bin/bash
# Get healthy proxy count
HEALTHY=$(proxywhirl --format json health | jq '.healthy')
echo "Healthy proxies: $HEALTHY"
# Alert if less than threshold
if [ "$HEALTHY" -lt 2 ]; then
echo "WARNING: Low proxy count!"
exit 1
fi
Automated Proxy Refresh¶
#!/bin/bash
# Daily proxy refresh script
proxywhirl fetch --concurrency 1000
proxywhirl health --continuous --interval 600 &
CI/CD Integration¶
# .github/workflows/validate-proxies.yml
name: Validate Proxy Sources
on:
schedule:
- cron: '0 */6 * * *' # Every 6 hours
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: uv sync
- run: uv run proxywhirl sources --validate --fail-on-unhealthy
- run: uv run proxywhirl fetch --concurrency 2000
- run: uv run proxywhirl export
Multi-Environment Configuration¶
# Development
proxywhirl --config dev.toml pool list
# Staging
proxywhirl --config staging.toml pool list
# Production
proxywhirl --config prod.toml pool list
Troubleshooting¶
Configuration Not Found¶
# Check discovery path
proxywhirl config show
# Initialize config
proxywhirl config init
Lock File Issues¶
# Skip locking for debugging
proxywhirl --no-lock pool list
# Remove stale lock
rm ~/.config/proxywhirl/.proxywhirl.lock
Slow Validation¶
# Increase concurrency (default is 100)
proxywhirl fetch --concurrency 2000
# Skip validation for testing
proxywhirl fetch --no-validate
GeoIP Enrichment Not Working¶
# Check database status
proxywhirl setup-geoip --check
# Follow setup instructions
proxywhirl setup-geoip
SSRF Protection Blocking Local Tests¶
# Use --allow-private flag for local testing
proxywhirl pool test http://proxy.example.com:8080 \
--target-url http://localhost:8000 \
--allow-private
# Note: Only use with trusted, internal services
Environment Variables¶
Variable |
Description |
|---|---|
|
Encryption key for credential encryption (default key location: |
|
Encryption key for cache encryption (optional) |
|
Disable colored output (standard environment variable) |
|
Override terminal width detection |
Exit Codes¶
Code |
Meaning |
|---|---|
|
Success (operation completed successfully) |
|
General error (invalid arguments, failed operation, validation failure, SSRF protection triggered) |
Common Exit Code 1 Scenarios:
Invalid URL format or scheme
SSRF protection triggered (localhost/private IP access denied)
Proxy not found in pool
Configuration file not found or invalid
Request failed after all retries
Source validation failed (with
--fail-on-unhealthy)Lock acquisition timeout
Note
The CLI uses file locking by default to prevent concurrent modifications. Use --no-lock only when you’re certain no other proxywhirl processes are running.
See Also¶
Complete TOML configuration reference, environment variables, and auto-discovery paths.
Detailed rotation strategy configuration for use with config set rotation_strategy.
Retry policies and circuit breaker settings referenced by stats command output.
Cache configuration for TOML settings and cache warming from CLI.
CI/CD workflows using CLI commands for automated proxy refresh.
Production deployment patterns with the CLI and Docker.