{"id":20291063,"url":"https://github.com/theruziev/aiorate_limiter","last_synced_at":"2025-07-01T11:08:23.778Z","repository":{"id":35530585,"uuid":"203982220","full_name":"theruziev/aiorate_limiter","owner":"theruziev","description":"A simple asyncio ready python implementation of a general purpose rate limiter based on Token Bucket algorithm","archived":false,"fork":false,"pushed_at":"2023-06-26T12:57:44.000Z","size":133,"stargazers_count":3,"open_issues_count":9,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T01:32:11.658Z","etag":null,"topics":["asyncio","python36","python37","rate-limiter","tokenbucket"],"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/theruziev.png","metadata":{"files":{"readme":"README.rst","changelog":null,"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":"2019-08-23T11:02:39.000Z","updated_at":"2024-07-03T18:54:00.000Z","dependencies_parsed_at":"2025-01-14T09:11:16.613Z","dependency_job_id":"590f6408-3ca4-4ed7-9c71-285aa98cf073","html_url":"https://github.com/theruziev/aiorate_limiter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/theruziev/aiorate_limiter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theruziev%2Faiorate_limiter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theruziev%2Faiorate_limiter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theruziev%2Faiorate_limiter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theruziev%2Faiorate_limiter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theruziev","download_url":"https://codeload.github.com/theruziev/aiorate_limiter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theruziev%2Faiorate_limiter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262950349,"owners_count":23389644,"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":["asyncio","python36","python37","rate-limiter","tokenbucket"],"created_at":"2024-11-14T15:10:17.360Z","updated_at":"2025-07-01T11:08:23.745Z","avatar_url":"https://github.com/theruziev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":".. image:: https://img.shields.io/travis/com/theruziev/aiorate_limiter.svg?style=flat-square\n        :target: https://travis-ci.com/theruziev/aiorate_limiter\n.. image:: https://img.shields.io/codecov/c/github/theruziev/aiorate_limiter.svg?style=flat-square\n        :target: https://codecov.io/gh/theruziev/aiorate_limiter\n\n\nAioRate Limiter\n===============\n\nA simple **asyncio**-ready Python implementation of a general purpose rate limiter based on\n`Token Bucket algorithm \u003chttps://en.wikipedia.org/wiki/Token_bucket\u003e`_.\n\nSupported storage\n-----------------\n\n* Memory\n* Redis (`aioredis \u003chttps://github.com/aio-libs/aioredis\u003e`_)\n\n\n⚡ Quickstart\n-------------\n\nRateLimiter is really easy to use.\n\nBasic Example:\n~~~~~~~~~~~~~~\n\n.. code-block:: python\n\n\t# 5 req/sec\n\topts = RateLimiterOpts(points=5, duration=1000)\n\tlimiter = MemoryRateLimiter(opts)\n\t# initialize limiter\n\tawait limiter.init()\n\t# Consume\n\tresult = limiter.consume(\"request_1\", 1) # Consume for a request_1 1 point\n\t# Check is allowed\n\tif result.is_allowed:\n\t\t# Happy!!! 1 point consumed\n\telse:\n\t\t# Be a strong, points is ended. Try again later.\n\n\nRateLimiterOpts\n~~~~~~~~~~~~~~~\n\nOptions class for a configure rate limiter\n\n**Params:**\n\n* **points** - Maximum number of points can be consumed over duration\n* **duration** - Number of milliseconds before consumed points are reset\n* **key_prefix** - If you need to create several limiters for different purpose.\n\n\nRateLimiterResult\n~~~~~~~~~~~~~~~~~\n\nAn object which returned when consume points\n\n**Params:**\n\n* **remaining_points** - Number of remaining points in current duration\n* **ms_before_next** - Number of milliseconds before next action can be done\n* **consumed_points** - Number of consumed points in current duration\n* **is_allowed** - Result of consume, true if allow otherwise false\n\n\nDeveloping\n-------------\n\nTo install development dependencies:\n\n.. code-block:: bash\n\n    make install\n\nLint:\n\n.. code-block:: bash\n\n    make lint\n\n\nFormatting code:\n\n.. code-block:: bash\n\n    make format\n\nTest:\n\n.. code-block:: bash\n\n    make test\n    # or run tox\n    tox\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheruziev%2Faiorate_limiter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheruziev%2Faiorate_limiter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheruziev%2Faiorate_limiter/lists"}