Skip to main content

A flexible and efficient rate limiting library for Django applications

Project description

Django Smart Ratelimit

CI Coverage PyPI version Downloads License

The checkmate for abusive traffic.

A high-performance, stateless rate limiting library for Django that protects your API from abuse, optimized for distributed systems with atomic Redis operations and circuit breaking.

Sponsors

Support the ongoing development of Django Smart Ratelimit!

Become a sponsor to see your logo here!

Key Features

  • 🚀 Stateless & Modern: Dual-mode support (Sync/Async) without database dependencies.
  • 🛡️ Enterprise Reliability: Built-in Circuit Breaker and Automatic Failover strategies.
  • ⚡ Multiple Algorithms: Choose between Token Bucket, Sliding Window, and Fixed Window.
  • 🔌 Flexible Backends: Redis (recommended), Async Redis, Memory, or Custom backends.
  • 🎯 Precise Control: Rate limit by IP, User, Header, or any custom callable.

Quick Start

Installation

pip install django-smart-ratelimit[redis]

Usage in 30 Seconds

from django_smart_ratelimit import rate_limit

@rate_limit(key='ip', rate='5/m', block=True)
def login_view(request):
    # If limit is exceeded, this code receives a 429 Too Many Requests
    return authenticate(request)

Documentation

We have moved our detailed documentation to the dedicated docs/ folder:

Topic Description
📚 Full Documentation Start here for the complete guide.
🚀 Migration Guide Upgrading from django-ratelimit? clear steps here.
🧮 Algorithms Deep dive into Token Buckets and Windows.
⚙️ Configuration Advanced settings, Backends, and Circuit Breakers.
🔍 Design Philosophy Why we built this and how it compares to others.

Contributing

We welcome contributions! Please see CONTRIBUTING.md for details on how to submit pull requests, report issues, and setup your development environment.

Community & Support

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_smart_ratelimit-1.0.0.tar.gz (180.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_smart_ratelimit-1.0.0-py3-none-any.whl (97.3 kB view details)

Uploaded Python 3

File details

Details for the file django_smart_ratelimit-1.0.0.tar.gz.

File metadata

  • Download URL: django_smart_ratelimit-1.0.0.tar.gz
  • Upload date:
  • Size: 180.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_smart_ratelimit-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cd5f20d216a1970ee59d662fe005de9057eec7d4236e25b65b439c11287ac5c0
MD5 41b6346e5aaf30d2e8aff7a285c323e5
BLAKE2b-256 e255d4489d0d93c52fad37a19ac22803560bddbe20cc1d4d1b05980a7e4ed475

See more details on using hashes here.

File details

Details for the file django_smart_ratelimit-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_smart_ratelimit-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 986cd9f46a9fba5d690a4cc0409aa24dc38f56205b92382ed4990c2d9c92874f
MD5 96b30092905d6ff43002c7fe2212e6eb
BLAKE2b-256 1b4146dd2c9571a47eba5e9247964aa0a9bdd01a69f46b0fa6e5fe0f8e11175d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page