Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask RLMT (Flask Rate Limiter)

About

This project is a rate limiter for Flask, and allows you to apply rate limit rules to routes, blueprints, or apply global limits that affect all routes.

Current Stratagies

  • Sliding window

Installation

This project is registered with PyPi, and can be installed with

pip install flask_rlmt

How to use

  1. Import flask_rlmt
import flask_rlmt
  1. Create a new limiter
app = Flask(__name__)

limiter = Limiter(
    app=app,
    rules=[
        "10 per minute",
        "100 per hour"
    ]
)
  1. Add rules to an individual route
@app.route("/")
@limiter.guard(rules=["1000/d"])
def home():
  1. Apply rules to an entire blueprint
auth_bp = Blueprint('auth', __name__, url_prefix='/auth')

limiter.apply(auth_bp, rules=["2 per 10s"])

app.register_blueprint(auth_bp)

Detailed Instructions

For further questions on how to interact with the API, please refer to the docs/QUICKSTART.md.

About

Rate limiter for Flask

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages