flask-limiter 4.0.0


pip install flask-limiter

  Latest version

Released: Sep 30, 2025


Meta
Author: Ali-Akber Saifee
Maintainer: Ali-Akber Saifee
Requires Python: >=3.10

Classifiers

Development Status
  • 5 - Production/Stable

Environment
  • Web Environment

Framework
  • Flask

Intended Audience
  • Developers

Operating System
  • MacOS
  • OS Independent
  • POSIX :: Linux

Programming Language
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13

Topic
  • Software Development :: Libraries :: Python Modules

docs ci codecov pypi license

Flask-Limiter adds rate limiting to Flask applications.

You can configure rate limits at different levels such as:

Flask-Limiter can be configured to fit your application in many ways, including:

  • Persistance to various commonly used storage backends (such as Redis, Memcached & MongoDB) via limits

  • Any rate limiting strategy supported by limits

Follow the quickstart below to get started or read the documentation for more details.

Quickstart

Install

pip install Flask-Limiter

Add the rate limiter to your flask app

# app.py

from flask import Flask
from flask_limiter import Limiter
from flask_limiter.util import get_remote_address

app = Flask(__name__)
limiter = Limiter(
    get_remote_address,
    app=app,
    default_limits=["2 per minute", "1 per second"],
    storage_uri="memory://",
    # Redis
    # storage_uri="redis://localhost:6379",
    # Redis cluster
    # storage_uri="redis+cluster://localhost:7000,localhost:7001,localhost:70002",
    # Memcached
    # storage_uri="memcached://localhost:11211",
    # Memcached Cluster
    # storage_uri="memcached://localhost:11211,localhost:11212,localhost:11213",
    # MongoDB
    # storage_uri="mongodb://localhost:27017",
    strategy="fixed-window", # or "moving-window", or "sliding-window-counter"
)

@app.route("/slow")
@limiter.limit("1 per day")
def slow():
    return "24"

@app.route("/fast")
def fast():
    return "42"

@app.route("/ping")
@limiter.exempt
def ping():
    return 'PONG'

Inspect the limits using the command line interface

$ FLASK_APP=app:app flask limiter limits

app
├── fast: /fast
   ├── 2 per 1 minute
   └── 1 per 1 second
├── ping: /ping
   └── Exempt
└── slow: /slow
    └── 1 per 1 day

Run the app

$ FLASK_APP=app:app flask run

Test it out

The fast endpoint respects the default rate limit while the slow endpoint uses the decorated one. ping has no rate limit associated with it.

$ curl localhost:5000/fast
42
$ curl localhost:5000/fast
42
$ curl localhost:5000/fast
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>429 Too Many Requests</title>
<h1>Too Many Requests</h1>
<p>2 per 1 minute</p>
$ curl localhost:5000/slow
24
$ curl localhost:5000/slow
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>429 Too Many Requests</title>
<h1>Too Many Requests</h1>
<p>1 per 1 day</p>
$ curl localhost:5000/ping
PONG
$ curl localhost:5000/ping
PONG
$ curl localhost:5000/ping
PONG
$ curl localhost:5000/ping
PONG
4.0.0 Sep 30, 2025
3.13 Sep 12, 2025
3.12 Mar 15, 2025
3.11.0 Mar 11, 2025
3.10.1 Jan 16, 2025
3.10.0 Jan 05, 2025
3.9.2 Nov 27, 2024
3.9.0 Nov 27, 2024
3.8.0 Jul 21, 2024
3.7.0 May 19, 2024
3.6.0 Apr 21, 2024
3.5.1 Feb 11, 2024
3.5.0 Aug 31, 2023
3.4.1 Aug 26, 2023
3.4.0 Aug 22, 2023
3.3.1 May 03, 2023
3.3.0 Feb 27, 2023
3.2.0 Feb 16, 2023
3.1.0 Dec 29, 2022
3.0.0 Dec 28, 2022
3.0.0b2 Dec 28, 2022
3.0.0b1 Dec 27, 2022
2.9.2 Dec 26, 2022
2.9.1 Dec 26, 2022
2.9.0 Dec 24, 2022
2.8.1 Nov 15, 2022
2.8.0 Nov 13, 2022
2.7.0 Oct 25, 2022
2.6.3 Sep 22, 2022
2.6.2 Aug 24, 2022
2.6.1 Aug 24, 2022
2.6.0 Aug 11, 2022
2.5.1 Aug 06, 2022
2.5.0 Jul 08, 2022
2.4.6 Jun 07, 2022
2.4.5.1 Apr 22, 2022
2.4.5 Apr 22, 2022
2.4.4 Apr 22, 2022
2.4.3 Apr 22, 2022
2.4.2 Apr 22, 2022
2.4.1 Apr 22, 2022
2.4.0 Apr 21, 2022
2.3.3 Apr 20, 2022
2.3.2 Apr 18, 2022
2.3.1 Apr 14, 2022
2.3.0 Apr 11, 2022
2.2.0 Mar 06, 2022
2.1.3 Jan 31, 2022
2.1.2 Jan 30, 2022
2.1.1 Jan 30, 2022
2.1 Jan 16, 2022
2.0.4 Dec 23, 2021
2.0.3 Dec 16, 2021
2.0.2 Nov 28, 2021
2.0.1 Nov 28, 2021
2.0.0 Nov 27, 2021
1.5 Nov 27, 2021
1.4 Aug 25, 2020
1.3.1 May 22, 2020
1.3 May 20, 2020
1.2.1 Feb 26, 2020
1.2.0 Feb 25, 2020
1.1.0 Oct 03, 2019
1.0.1 Dec 07, 2017
1.0.0 Nov 06, 2017
1.0.0rc1 Oct 26, 2017
0.9.5.1 Aug 18, 2017
0.9.5 Jul 26, 2017
0.9.4 Apr 30, 2017
0.9.3 Mar 14, 2016
0.9.2 Mar 04, 2016
0.9.1 Nov 21, 2015
0.9 Nov 13, 2015
0.8.5 Oct 05, 2015
0.8.4 Oct 03, 2015
0.8.3 Oct 03, 2015
0.8.2 Sep 16, 2015
0.8.1 Aug 06, 2015
0.8 Jun 06, 2015
0.7.9 Apr 01, 2015
0.7.8 Mar 20, 2015
0.7.6 Mar 02, 2015
0.7.5 Feb 16, 2015
0.7.4 Feb 03, 2015
0.7.3 Jan 30, 2015
0.7.1 Jan 09, 2015
0.7 Jan 08, 2015
0.6.6 Oct 21, 2014
0.6.5 Oct 01, 2014
0.6.4 Aug 31, 2014
0.6.3 Aug 26, 2014
0.6.2 Jul 13, 2014
0.6.1 Jul 11, 2014
0.6 Jun 24, 2014
0.5 Jun 13, 2014
0.4.4 Jun 13, 2014
0.4.3 Jun 12, 2014
0.4.2 Jun 12, 2014
0.4.1 Jun 04, 2014
0.4 May 28, 2014
0.3.2 May 26, 2014
0.3.1 Feb 20, 2014
0.3.0 Feb 19, 2014
0.2.2 Feb 18, 2014
0.2.1 Feb 15, 2014
0.2 Feb 15, 2014
0.1.1 Feb 13, 2014
0.1.0 Feb 13, 2014
0.0.1 Feb 12, 2014

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras:
Dependencies:
flask (>=2)
limits (>=3.13)
ordered-set (<5,>4)
rich (<15,>=12)
typing-extensions (>=4.3)