redis-ratelimit 1.0.3

Creator: bradpython12

Last updated:

Add to Cart

Description:

redisratelimit 1.0.3

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

Redis Rate Limiting Pattern #2

License
MIT

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.