garm-rate-limiter

Rate Limiter for Flask


Keywords
garm_rate_limiter
License
MIT
Install
pip install garm-rate-limiter==0.1.3

Documentation

Garm Rate Limiter

Source code on Github PyPI Documentation Docs Tests Coverage MIT License

IP address based rate limiter for Flask

Development of Garm Rate Limiter happens on Github.

You can read the full documentation online. [IN PROGRESS]

NB: Route specific rate limiting has not been implemented yet. The specified rate limiting will apply individually to every flask route.

Installation

To install the latest released version of Garm Rate Limiter, run this command in your terminal:

pip install garm_rate_limiter

This is the preferred method to install Garm Rate Limiter, as it will always install the most recent stable release.

If you don't have pip installed, the Python installation guide, respectively the Python Packaging User Guide can guide you through the process.

To install the latest development version of Garm Rate Limiter from Github.

pip install git+https://github.com/burakozdemir32/garm_rate_limiter.git@main#egg=garm_rate_limiter

Usage

To use Garm Rate Limiter in a Flask project:

from datetime import timedelta

from flask import Flask

from garm_rate_limiter.config import RateLimiterConfig
from garm_rate_limiter.limiter import RateLimiterMiddleware

app = Flask(__name__)

rate_limiter_config = RateLimiterConfig(limit=10, time=timedelta(seconds=60))
app.wsgi_app = RateLimiterMiddleware(config=rate_limiter_config, app=app.wsgi_app)