proxywhirl.rate_limiting.limiter¶
Core rate limiter implementation using pyrate-limiter.
Classes¶
Async rate limiter for use in async contexts. |
|
Rate limiter with per-proxy and global limits using pyrate-limiter. |
|
Synchronous rate limiter for use in sync contexts. |
Module Contents¶
- class proxywhirl.rate_limiting.limiter.AsyncRateLimiter(global_limit=None)[source]¶
Async rate limiter for use in async contexts.
This class provides an async-safe interface using asyncio.Lock. Use this class when calling from async functions to avoid blocking the event loop.
Initialize async rate limiter.
- Parameters:
global_limit (proxywhirl.rate_limiting.models.RateLimit | None)
- class proxywhirl.rate_limiting.limiter.RateLimiter(global_limit=None)[source]¶
Rate limiter with per-proxy and global limits using pyrate-limiter.
DEPRECATED: Use AsyncRateLimiter for async contexts or SyncRateLimiter for sync contexts. This class maintains backwards compatibility by using threading.RLock.
Initialize rate limiter.
- Parameters:
global_limit (proxywhirl.rate_limiting.models.RateLimit | None)
- class proxywhirl.rate_limiting.limiter.SyncRateLimiter(global_limit=None)[source]¶
Synchronous rate limiter for use in sync contexts.
This class provides a thread-safe, synchronous interface to rate limiting without requiring asyncio.run() calls, which can fail when called from an existing event loop or create performance overhead.
Initialize synchronous rate limiter.
- Parameters:
global_limit (proxywhirl.rate_limiting.models.RateLimit | None)