{"id":18474433,"url":"https://github.com/pgjones/quart-rate-limiter","last_synced_at":"2025-04-09T12:05:51.630Z","repository":{"id":49094137,"uuid":"477742305","full_name":"pgjones/quart-rate-limiter","owner":"pgjones","description":"Quart-Rate-Limiter is an extension for Quart to allow for rate limits to be defined and enforced on a per route basis.","archived":false,"fork":false,"pushed_at":"2024-12-24T11:34:35.000Z","size":73,"stargazers_count":26,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T11:04:43.477Z","etag":null,"topics":["quart"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pgjones.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-04T14:39:45.000Z","updated_at":"2025-02-26T06:14:50.000Z","dependencies_parsed_at":"2024-06-21T15:44:22.466Z","dependency_job_id":"333701e4-ad73-46f1-be45-9042cce2467a","html_url":"https://github.com/pgjones/quart-rate-limiter","commit_stats":{"total_commits":55,"total_committers":4,"mean_commits":13.75,"dds":0.07272727272727275,"last_synced_commit":"88aa0471a74cba50266551fed4476f4216c18b69"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgjones%2Fquart-rate-limiter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgjones%2Fquart-rate-limiter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgjones%2Fquart-rate-limiter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgjones%2Fquart-rate-limiter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pgjones","download_url":"https://codeload.github.com/pgjones/quart-rate-limiter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248036063,"owners_count":21037092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["quart"],"created_at":"2024-11-06T10:29:26.471Z","updated_at":"2025-04-09T12:05:51.599Z","avatar_url":"https://github.com/pgjones.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Quart-Rate-Limiter\n==================\n\n|Build Status| |docs| |pypi| |python| |license|\n\nQuart-Rate-Limiter is an extension for `Quart\n\u003chttps://github.com/pgjones/quart\u003e`_ to allow for rate limits to be\ndefined and enforced on a per route basis. The 429 error response\nincludes a `RFC7231\n\u003chttps://tools.ietf.org/html/rfc7231#section-7.1.3\u003e`_ compliant\n``Retry-After`` header and the successful responses contain headers\ncompliant with the `RateLimit Header Fields for HTTP\n\u003chttps://tools.ietf.org/html/draft-polli-ratelimit-headers-00\u003e`_ RFC\ndraft.\n\nQuickstart\n----------\n\nTo add a rate limit first initialise the RateLimiting extension with\nthe application, and then rate limit the route,\n\n.. code-block:: python\n\n    app = Quart(__name__)\n    rate_limiter = RateLimiter(app)\n\n    @app.get('/')\n    @rate_limit(1, timedelta(seconds=10))\n    async def handler():\n        ...\n\nSimple examples\n~~~~~~~~~~~~~~~\n\nTo limit a route to 1 request per second and a maximum of 20 per minute,\n\n.. code-block:: python\n\n    @app.route('/')\n    @rate_limit(1, timedelta(seconds=1))\n    @rate_limit(20, timedelta(minutes=1))\n    async def handler():\n        ...\n\nAlternatively the ``limits`` argument can be used for multiple limits,\n\n.. code-block:: python\n\n    @app.route('/')\n    @rate_limit(\n        limits=[\n            RateLimit(1, timedelta(seconds=1)),\n            RateLimit(20, timedelta(minutes=1)),\n        ],\n    )\n    async def handler():\n        ...\n\nTo identify remote users based on their authentication ID, rather than\ntheir IP,\n\n.. code-block:: python\n\n    async def key_function():\n        return current_user.id\n\n    RateLimiter(app, key_function=key_function)\n\nThe ``key_function`` is a coroutine function to allow session lookups\nif appropriate.\n\nContributing\n------------\n\nQuart-Rate-Limiter is developed on `GitHub\n\u003chttps://github.com/pgjones/quart-rate-limiter\u003e`_. You are very welcome to\nopen `issues \u003chttps://github.com/pgjones/quart-rate-limiter/issues\u003e`_ or\npropose `merge requests\n\u003chttps://github.com/pgjones/quart-rate-limiter/merge_requests\u003e`_.\n\nTesting\n~~~~~~~\n\nThe best way to test Quart-Rate-Limiter is with Tox,\n\n.. code-block:: console\n\n    $ pip install tox\n    $ tox\n\nthis will check the code style and run the tests.\n\nHelp\n----\n\nThe Quart-Rate-Limiter `documentation\n\u003chttps://quart-rate-limiter.readthedocs.io/en/latest/\u003e`_ is the best\nplaces to start, after that try searching `stack overflow\n\u003chttps://stackoverflow.com/questions/tagged/quart\u003e`_ or ask for help\n`on gitter \u003chttps://gitter.im/python-quart/lobby\u003e`_. If you still\ncan't find an answer please `open an issue\n\u003chttps://github.com/pgjones/quart-rate-limiter/issues\u003e`_.\n\n\n.. |Build Status| image:: https://github.com/pgjones/quart-rate-limiter/actions/workflows/ci.yml/badge.svg\n   :target: https://github.com/pgjones/quart-rate-limiter/commits/main\n\n.. |docs| image:: https://readthedocs.org/projects/quart-rate-limiter/badge/?version=latest\u0026style=flat\n   :target: https://quart-rate-limiter.readthedocs.io/en/latest/\n\n.. |pypi| image:: https://img.shields.io/pypi/v/quart-rate-limiter.svg\n   :target: https://pypi.python.org/pypi/Quart-Rate-Limiter/\n\n.. |python| image:: https://img.shields.io/pypi/pyversions/quart-rate-limiter.svg\n   :target: https://pypi.python.org/pypi/Quart-Rate-Limiter/\n\n.. |license| image:: https://img.shields.io/badge/license-MIT-blue.svg\n   :target: https://github.com/pgjones/quart-rate-limiter/blob/main/LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgjones%2Fquart-rate-limiter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpgjones%2Fquart-rate-limiter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgjones%2Fquart-rate-limiter/lists"}