No project description provided
Project description
🚦 Flask Rate Limiter – Reusable Decorator Library
A reusable, production-style rate limiting library for Flask applications, implemented using four industry-standard algorithms and distributed via PyPI.
Designed with system design principles, the Strategy Pattern, and real-world API use cases in mind.
Features
- Decorator-based rate limiting for Flask routes
- Supports four algorithms:
- Fixed Window
- Sliding Window
- Leaky Bucket
- Token Bucket
- Per-user and per-endpoint enforcement
- Clean, extensible strategy-based architecture
- In-memory state management for simplicity
- Optional metrics support for observability
- Designed as a reusable Python package
Important
- All decorators are fully documented using Python docstrings, so IDEs show parameter details on hover.
Common Params:
-
algorithm (str)
-
Rate limiting algorithm to apply.
-
Supported values:
-
"fixed_window"
-
"sliding_window"
-
"leaky_bucket"
-
"token_bucket"
-
capacity (int)
- Maximum number of requests allowed within a window or bucket.
-
refill_rate (int, optional)
- Tokens added per second (used in Token Bucket).
-
window_size (int, optional)
- Time window in seconds (used in Fixed Window and Sliding Window).
-
user_identifier (callable, optional)
- Function to extract a user identifier (IP address, user ID, auth token, etc.).
Installation
Install directly from PyPI:
pip install flask-rate-limiter-lite
Quick Start
from flask import Flask from flask_rate_limiter import rate_limit
app = Flask(name)
@app.route("/api") @rate_limit( algorithm="token_bucket", capacity=10, refill_rate=1 ) def api(): return "Hello, World!"
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flask_rate_limiter_lite-0.1.5.tar.gz.
File metadata
- Download URL: flask_rate_limiter_lite-0.1.5.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b39ab8e825f254d7edec01156c2cd721fab9f75f52b1c6433f18af0c055c19d9
|
|
| MD5 |
0034e2ae710f52e9bc7fb78a206479b4
|
|
| BLAKE2b-256 |
23663de2cfa6dcac646b2228ede3a531cba110b985cd487ab3e8336368053bdd
|
File details
Details for the file flask_rate_limiter_lite-0.1.5-py3-none-any.whl.
File metadata
- Download URL: flask_rate_limiter_lite-0.1.5-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee12587736231314bd033432a2ab17fb7d38e6065629bb0f874fb4fc3c0207fe
|
|
| MD5 |
83e1e0541973509aef24d1c86bd45aae
|
|
| BLAKE2b-256 |
44fe3cf752b0dd688ed15dfe997d5ee217747b9658dc4a1a2268eb462e15cc77
|