Skip to content

Latest commit

 

History

1,146 Commits

Folders and files

Repository files navigation

ProxyWhirl



Intelligent proxy rotation that just works


PyPI version PyPI downloads CI status License Python 3.10+


Stats


Docs
  
Examples
  
Discussions




30-Second Setup

# Install uv first if needed
brew install uv
# Other platforms: https://docs.astral.sh/uv/getting-started/installation/

# Add ProxyWhirl to a uv-managed project
uv add proxywhirl

# Or try the CLI without installing it first
uvx proxywhirl --help

Prefer uv tool install proxywhirl when you want the proxywhirl CLI available globally.

Developer commands (contributing to ProxyWhirl itself):

git clone https://github.com/wyattowalsh/proxywhirl.git && cd proxywhirl
uv sync

just quality-gates
just --list
from proxywhirl import ProxyWhirl

# Drop it in as your HTTP client; the first request fetches across all enabled
# built-in public sources, validates the results, and keeps the pool in memory.
rotator = ProxyWhirl()
response = rotator.get("https://api.example.com/data")
# Dead proxies are ejected, slow ones are deprioritized, and fast ones are favored.



Why ProxyWhirl?




9 Strategies
Round-robin, weighted, geo-targeted, performance-based & more




70 Sources
Auto-fetch from built-in providers with validation




Self-Healing
Auto-eject dead proxies, circuit breakers, recovery




Blazing Fast
Async-first, <3μs selection, zero blocking




Rotation Strategies

# Switch strategies on the fly (name string or strategy instance)
rotator = ProxyWhirl(strategy="performance-based")
rotator.set_strategy("geo-targeted")

# Geo targeting filters via SelectionContext on strategy.select()
from proxywhirl import SelectionContext

proxy = rotator.strategy.select(
    rotator.pool,
    SelectionContext(target_country="US"),
)
Strategy Best For
round-robin Even distribution
random Unpredictable patterns
weighted Favor reliable proxies
least-used Even load balance
performance-based Lowest latency
geo-targeted Regional routing
session-persistence Sticky sessions
cost-aware Budget optimization
composite Custom pipelines



Auto-Fetch Proxies

from proxywhirl import BootstrapConfig, ProxyWhirl

# Default: lazy auto-fetch from every enabled built-in source when the pool is empty.
rotator = ProxyWhirl()
response = rotator.get("https://api.example.com/data")

# Tune bootstrap behavior when you want lighter startup or tighter caps.
rotator = ProxyWhirl(bootstrap=BootstrapConfig(sample_size=20, max_proxies=200))



Multiple Interfaces

Python API

rotator.get(url)
rotator.post(url, json=data)
async with AsyncProxyWhirl() as async_rotator:
    await async_rotator.get(url)

CLI

uvx proxywhirl fetch
uvx proxywhirl sources --validate --fail-on-unhealthy --timeout 5 --concurrency 5
uv run proxywhirl pool list
proxywhirl health  # after `uv tool install proxywhirl`

REST API

docker-compose up -d
curl localhost:8000/api/proxies

Warning

The REST API and MCP server can run without authentication on loopback by default (PROXYWHIRL_REQUIRE_AUTH=false, no PROXYWHIRL_MCP_API_KEY) for local development. API startup fails closed when PROXYWHIRL_BIND_HOST is non-loopback without authentication. Before exposing either service beyond localhost, set PROXYWHIRL_REQUIRE_AUTH=true plus PROXYWHIRL_API_KEY, and set PROXYWHIRL_MCP_API_KEY. See the Deployment guide for the full hardening checklist.




Learn More


  Full Documentation  
   
  Strategy Matrix  
   
  MCP Server  
   
  Examples  





Star History


GitHub · Issues · MIT License

Built with ❤️ for ethical web automation