Skip to main content

A fixed window rate limiter based on Redis

Project description


Travis Coveralls PyPI PyPI - Python Version

A fixed window rate limiter based on Redis


$ 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__)

@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.




Project details

Download files

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

Files for redis-ratelimit, version 1.0.3
Filename, size File type Python version Upload date Hashes
Filename, size redis_ratelimit-1.0.3-py2.py3-none-any.whl (3.5 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size redis-ratelimit-1.0.3.tar.gz (3.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page