{"id":25269934,"url":"https://github.com/aymenjd/py-redis-ratelimit","last_synced_at":"2025-10-27T07:32:01.167Z","repository":{"id":144428711,"uuid":"504405864","full_name":"AYMENJD/py-redis-ratelimit","owner":"AYMENJD","description":"A simple asyncio-based rate limiter for python using Redis.","archived":false,"fork":false,"pushed_at":"2022-12-06T16:05:10.000Z","size":8,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T01:40:06.243Z","etag":null,"topics":["asyncio","rate-limit","redis","spam"],"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/AYMENJD.png","metadata":{"files":{"readme":"README.md","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}},"created_at":"2022-06-17T05:31:45.000Z","updated_at":"2023-04-29T08:31:02.000Z","dependencies_parsed_at":"2023-09-24T06:31:58.764Z","dependency_job_id":null,"html_url":"https://github.com/AYMENJD/py-redis-ratelimit","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"220ed6092b7c4a6c5264387347a36f7bac4e731d"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AYMENJD%2Fpy-redis-ratelimit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AYMENJD%2Fpy-redis-ratelimit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AYMENJD%2Fpy-redis-ratelimit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AYMENJD%2Fpy-redis-ratelimit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AYMENJD","download_url":"https://codeload.github.com/AYMENJD/py-redis-ratelimit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238463121,"owners_count":19476647,"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","rate-limit","redis","spam"],"created_at":"2025-02-12T11:28:01.352Z","updated_at":"2025-10-27T07:32:00.854Z","avatar_url":"https://github.com/AYMENJD.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# py-redis-ratelimit [![version](https://img.shields.io/pypi/v/py-redis-ratelimit?style=flat\u0026logo=pypi)](https://pypi.org/project/py-redis-ratelimit) [![downloads](https://img.shields.io/pypi/dm/py-redis-ratelimit?style=flat)](https://pypistats.org/packages/py-redis-ratelimit)\n\n A simple asynchronous rate limiter based on redis.\n\n### Requirements\n\n- python \u003e= 3.7\n- [redis-py](https://github.com/redis/redis-py) \u003e= 4.2.0\n\n### Installation\n\n```bash\npip install py-redis-ratelimit\n```\n\n### Examples\nBasic example:\n```python\n\nfrom redis.asyncio import Redis\nimport ratelimit, asyncio\n\nredis = Redis(decode_responses=True)\nlimiter = ratelimit.RateLimit(\n    redis, prefix=\"api_rate_limit\", rate=10, period=60, retry_after=20\n)\nprint(ratelimit.RateLimit.__doc__)  # print RateLimit class docstring\n\n\nasync def do_something():\n    await limiter.acquire(\n        identifier=\"do_something_function\"\n    )  # a unique identifier for the function. This let's RateLimit know what service/resource you are trying to access.\n    ...\n\n\nasync def main():\n    for x in range(40):\n        try:\n            print(\"Calling do_something() for the {}th time\".format(x + 1))\n            await do_something()\n        except ratelimit.FloodWait as e:\n            print(\"Exception:\", e.to_dict())\n            break\n\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n\n```\n\n# Contributing\nPull requests are always welcome!!\n# License\n\nMIT [License](https://github.com/AYMENJD/py-redis-ratelimit/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faymenjd%2Fpy-redis-ratelimit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faymenjd%2Fpy-redis-ratelimit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faymenjd%2Fpy-redis-ratelimit/lists"}