A fixed window rate limiter based on Redis
Project description
redis-ratelimit
A fixed window rate limiter based on Redis
Installation
$ pip install redis-ratelimit
Example Usage
The library itself is framework agnostic, but let's assume you want to use it with Flask:
from flask import Flask, jsonify
from redis_ratelimit import ratelimit
app = Flask(__name__)
@app.route('/')
@ratelimit(rate='10/m', key='ccc')
@ratelimit(rate='2/s', key='ccc')
def index():
return jsonify({'status': 'OK'})
This will allow a total of 10 requests in any given minute, but no faster than 2 requests a second.
Notes
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
redis-ratelimit-1.0.3.tar.gz
(3.0 kB
view details)
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 redis-ratelimit-1.0.3.tar.gz.
File metadata
- Download URL: redis-ratelimit-1.0.3.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
088edb6ad0380e0c485f773d1831aaccfff2d8dc56bb63a3cabf97969f37ebb1
|
|
| MD5 |
cca6fb8bb5c451ec22953cbbf76d035f
|
|
| BLAKE2b-256 |
f60d922b759b80a16ece58619e4d0c605c7351f2ffe7c37e1692178929678ebe
|
File details
Details for the file redis_ratelimit-1.0.3-py2.py3-none-any.whl.
File metadata
- Download URL: redis_ratelimit-1.0.3-py2.py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db0fb15c8e1170d03255b4776de8c4adfbb39bd7d8f96712cee0076e52dfbceb
|
|
| MD5 |
229b0bbc634f2434bfacda6eb11c8ad3
|
|
| BLAKE2b-256 |
4f6ab3e918eb9e39f473aaa45c7beb59d99a68be4911cdf065e6446512121ba5
|