Skip to main content

A fixed window rate limiter based on Redis

Project description

redis-ratelimit

Travis Coveralls PyPI PyPI - Python Version

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


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)

Uploaded Source

Built Distribution

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

redis_ratelimit-1.0.3-py2.py3-none-any.whl (3.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file redis-ratelimit-1.0.3.tar.gz.

File metadata

File hashes

Hashes for redis-ratelimit-1.0.3.tar.gz
Algorithm Hash digest
SHA256 088edb6ad0380e0c485f773d1831aaccfff2d8dc56bb63a3cabf97969f37ebb1
MD5 cca6fb8bb5c451ec22953cbbf76d035f
BLAKE2b-256 f60d922b759b80a16ece58619e4d0c605c7351f2ffe7c37e1692178929678ebe

See more details on using hashes here.

File details

Details for the file redis_ratelimit-1.0.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for redis_ratelimit-1.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 db0fb15c8e1170d03255b4776de8c4adfbb39bd7d8f96712cee0076e52dfbceb
MD5 229b0bbc634f2434bfacda6eb11c8ad3
BLAKE2b-256 4f6ab3e918eb9e39f473aaa45c7beb59d99a68be4911cdf065e6446512121ba5

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