Skip to main content

Flask-Limiter

travis-ci coveralls pypi

Flask-Limiter provides rate limiting features to flask routes. It has support for a configurable backend for storage with current implementations for in-memory, redis and memcache.

Quickstart

Add the rate limiter to your flask app. The following example uses the default in memory implementation for storage.

from flask import Flask
from flask_limiter import Limiter

app = Flask(__name__)
limiter = Limiter(app, global_limits=["2 per minute", "1 per second"])

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

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

app.run()

Test it out. The fast endpoint respects the global rate limit while the slow endpoint uses the decorated one.

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

Read the docs

History

0.2.1 2014-02-15

  • python 2.6 support via counter backport

  • source docs.

0.2.1 2014-02-15

  • python 2.6 support via counter backport

  • source docs.

0.2 2014-02-15

  • Implemented configurable strategies for rate limiting.

  • Bug fixes

    • better locking for in-memory storage

    • multi threading support for memcached storage

0.1.1 2014-02-14

  • Bug fixes

    • fix initializing the extension without an app

    • don’t rate limit static files

0.1.0 2014-02-13

  • first release.

Metadata

Release files for Flask-Limiter 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Flask-Limiter 0.2.1
File Size Uploaded Provenance Actions
Flask-Limiter-0.2.1.tar.gz 101.1 kB Without provenance Details for Flask-Limiter-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for Flask-Limiter 0.2.1
File Interpreter ABI Platform Actions
Flask_Limiter-0.2.1-py2.7.egg Legacy Egg format - - Details for Flask_Limiter-0.2.1-py2.7.egg

Total release size: 145.6 kB

Release files / Flask-Limiter-0.2.1.tar.gz

Download URL Flask-Limiter-0.2.1.tar.gz
Size 101.1 kB
Tags Source
SHA-256 checksum
How to use checksums
da9f25a2d89bd0646123a2c02aafa37efa3de2c5db3ebd568e80ed56d1eaef1a
BLAKE2b-256 checksum
How to use checksums
3848d648830306b75e7214baed3ca69444cfff0db6a52542852f4b51d9e0bc43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / Flask_Limiter-0.2.1-py2.7.egg

Download URL Flask_Limiter-0.2.1-py2.7.egg
Size 44.6 kB
Tags Egg
SHA-256 checksum
How to use checksums
fd368ee58f6d1e33bf06248b06c78f2021fde2c25e22ec1c563efcec4dd0fd59
BLAKE2b-256 checksum
How to use checksums
7bcb6291204b6817b2af42fe49857357a2276d37a228d08951cee5944a4e4991
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for Flask-Limiter 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

0.7.7

0.7.2

This release

0.2.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page