{ "info": { "author": "Ali-Akber Saifee", "author_email": "ali@indydevs.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: MacOS", "Operating System :: OS Independent", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": ".. |travis-ci| image:: https://img.shields.io/travis/alisaifee/flask-limiter/master.svg?style=flat-square\n :target: https://travis-ci.org/#!/alisaifee/flask-limiter?branch=master\n.. |coveralls| image:: https://img.shields.io/coveralls/alisaifee/flask-limiter/master.svg?style=flat-square\n :target: https://coveralls.io/r/alisaifee/flask-limiter?branch=master\n.. |pypi| image:: https://img.shields.io/pypi/v/Flask-Limiter.svg?style=flat-square\n :target: https://pypi.python.org/pypi/Flask-Limiter\n.. |license| image:: https://img.shields.io/pypi/l/Flask-Limiter.svg?style=flat-square\n :target: https://pypi.python.org/pypi/Flask-Limiter\n.. |hound| image:: https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg?style=flat-square&longCache=true\n :target: https://houndci.com\n\n*************\nFlask-Limiter\n*************\n|travis-ci| |coveralls| |pypi| |license| |hound|\n\nFlask-Limiter provides rate limiting features to flask routes.\nIt has support for a configurable backend for storage\nwith current implementations for in-memory, redis and memcache.\n\nQuickstart\n===========\n\nAdd the rate limiter to your flask app. The following example uses the default\nin memory implementation for storage.\n\n.. code-block:: python\n\n from flask import Flask\n from flask_limiter import Limiter\n from flask_limiter.util import get_remote_address\n\n app = Flask(__name__)\n limiter = Limiter(\n app,\n key_func=get_remote_address,\n default_limits=[\"2 per minute\", \"1 per second\"],\n )\n\n @app.route(\"/slow\")\n @limiter.limit(\"1 per day\")\n def slow():\n return \"24\"\n\n @app.route(\"/fast\")\n def fast():\n return \"42\"\n\n @app.route(\"/ping\")\n @limiter.exempt\n def ping():\n return 'PONG'\n\n app.run()\n\n\n\nTest it out. The ``fast`` endpoint respects the default rate limit while the\n``slow`` endpoint uses the decorated one. ``ping`` has no rate limit associated\nwith it.\n\n.. code-block:: bash\n\n $ curl localhost:5000/fast\n 42\n $ curl localhost:5000/fast\n 42\n $ curl localhost:5000/fast\n \n
2 per 1 minute
\n $ curl localhost:5000/slow\n 24\n $ curl localhost:5000/slow\n \n1 per 1 day
\n $ curl localhost:5000/ping\n PONG\n $ curl localhost:5000/ping\n PONG\n $ curl localhost:5000/ping\n PONG\n $ curl localhost:5000/ping\n PONG\n\n\n\n\n`Read the docs