RateThrottle Documentation

RateThrottle is an advanced rate limiting and DDoS protection library for Python web applications. It provides enterprise-level features including multiple rate limiting strategies, multiple protocol support, DDoS protection, analytics, and seamless integration with popular web frameworks.

PyPI version License

Key Features

  • Multiple Rate Limiting Strategies: Token bucket, leaky bucket, fixed window, and sliding window algorithms

  • DDoS Protection: Advanced traffic analysis and automatic attack mitigation

  • Multi-Framework Support: Flask, FastAPI, Django, Starlette, and WSGI applications

  • Multi-Protocol Support: REST, GraphQL, gRPC, Websocket

  • Adaptive Ratelimiting: Statistical ML based adaptive ratelimiting

  • Flexible Storage: In-memory and Redis backends for distributed systems

  • Analytics & Monitoring: Comprehensive metrics, violation tracking, and reporting

  • Production Ready: Thread-safe, type-annotated, and thoroughly tested

  • Easy Integration: Simple decorators and middleware for quick setup

Quick Example

 from ratethrottle import RateThrottleCore, RateThrottleRule

# Create limiter
limiter = RateThrottleCore()

# Add rule
rule = RateThrottleRule(
   name='api_limit',
   limit=100,
   window=60,
   strategy='sliding_window'
)
limiter.add_rule(rule)

# Check rate limit
status = limiter.check_rate_limit('192.168.1.100', 'api_limit')

if status.allowed:
   # Process request
   print(f"Request allowed! {status.remaining} requests remaining")
else:
   # Reject request
   print(f"Request blocked! Retry after {status.retry_after} seconds")

Why RateThrottle?

Comprehensive Protection

Protect your APIs from abuse, scraping, and DDoS attacks with advanced detection algorithms.

Framework Agnostic

Works seamlessly with Flask, FastAPI, Django, Starlette, and any WSGI application.

Production Ready

Built with enterprise requirements in mind - thread-safe, distributed-ready, and highly performant.

Developer Friendly

Simple, intuitive API with extensive documentation and examples.

Adaptive Ratelimiting

ML based adative ratelimiting that adjust limits based on user behaviour

Getting Started

Support & Community

License

RateThrottle is released under the MIT License.

Indices and tables