{"id":13813770,"url":"https://github.com/EvoluxBR/python-redis-rate-limit","last_synced_at":"2025-05-15T01:31:42.606Z","repository":{"id":10027515,"uuid":"63997812","full_name":"EvoluxBR/python-redis-rate-limit","owner":"EvoluxBR","description":"Python Rate Limiter implemented based on Redis INCR, EXPIRE, EVALSHA and EVAL.","archived":false,"fork":false,"pushed_at":"2024-10-23T12:28:30.000Z","size":58,"stargazers_count":128,"open_issues_count":2,"forks_count":36,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T09:08:32.042Z","etag":null,"topics":["python","rate-limiting","redis"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EvoluxBR.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":"2016-07-23T03:50:41.000Z","updated_at":"2025-04-03T13:55:50.000Z","dependencies_parsed_at":"2024-01-20T15:56:47.005Z","dependency_job_id":"3f6fbec7-42c2-4d79-89f7-080df8878cc9","html_url":"https://github.com/EvoluxBR/python-redis-rate-limit","commit_stats":{"total_commits":48,"total_committers":9,"mean_commits":5.333333333333333,"dds":0.6666666666666667,"last_synced_commit":"630dc332b135d14be96405bba8b80ffe2d18f96f"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvoluxBR%2Fpython-redis-rate-limit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvoluxBR%2Fpython-redis-rate-limit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvoluxBR%2Fpython-redis-rate-limit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvoluxBR%2Fpython-redis-rate-limit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EvoluxBR","download_url":"https://codeload.github.com/EvoluxBR/python-redis-rate-limit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254256177,"owners_count":22040242,"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":["python","rate-limiting","redis"],"created_at":"2024-08-04T04:01:29.612Z","updated_at":"2025-05-15T01:31:37.671Z","avatar_url":"https://github.com/EvoluxBR.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"python-redis-rate-limit\n=======================\n.. image:: https://github.com/EvoluxBR/python-redis-rate-limit/actions/workflows/python-package.yml/badge.svg\n    :target: https://github.com/EvoluxBR/python-redis-rate-limit/actions/workflows/python-package.yml\n\n.. image:: https://img.shields.io/pypi/v/python-redis-rate-limit.svg\n    :target: https://pypi.python.org/pypi/python-redis-rate-limit\n\n.. image:: https://img.shields.io/pypi/dm/python-redis-rate-limit.svg\n    :target: https://pypi.python.org/pypi/python-redis-rate-limit\n\n\nThis lib offers an abstraction of a Rate Limit algorithm implemented on top of\nRedis \u003e= 2.6.0.\n\nSupported Python Versions: 2.7, 3.6+\n\nExample: 10 requests per second\n\n.. code-block:: python\n\n    from redis_rate_limit import RateLimit, TooManyRequests\n    try:\n      with RateLimit(resource='users_list', client='192.168.0.10', max_requests=10):\n        return '200 OK'\n    except TooManyRequests:\n      return '429 Too Many Requests'\n\nExample: using as a decorator\n\n.. code-block:: python\n\n    from redis_rate_limit import RateLimit, TooManyRequests\n\n    @RateLimit(resource='users_list', client='192.168.0.10', max_requests=10)\n    def list_users():\n      return '200 OK'\n\n    try:\n      return list_users()\n    except TooManyRequests:\n      return '429 Too Many Requests'\n\nExample: 600 requests per minute\n\n.. code-block:: python\n\n    from redis_rate_limit import RateLimit, TooManyRequests\n    try:\n      with RateLimit(resource='users_list', client='192.168.0.10', max_requests=600, expire=60):\n        return '200 OK'\n    except TooManyRequests:\n      return '429 Too Many Requests'\n\nExample: 100 requests per hour\n\n.. code-block:: python\n\n    from redis_rate_limit import RateLimit, TooManyRequests\n    try:\n      with RateLimit(resource='users_list', client='192.168.0.10', max_requests=100, expire=3600):\n        return '200 OK'\n    except TooManyRequests:\n      return '429 Too Many Requests'\n\nExample: you can also setup a factory to use it later\n\n.. code-block:: python\n\n    from redis_rate_limit import RateLimiter, TooManyRequests\n    limiter = RateLimiter(resource='users_list', max_requests=100, expire=3600)\n    try:\n      with limiter.limit(client='192.168.0.10'):\n        return '200 OK'\n    except TooManyRequests:\n      return '429 Too Many Requests'\n\nExample: you can also pass an optional Redis Pool\n\n.. code-block:: python\n\n    import redis\n    from redis_rate_limit import RateLimit, TooManyRequests\n    redis_pool = redis.ConnectionPool(host='127.0.0.1', port=6379, db=0)\n    try:\n      with RateLimit(resource='users_list', client='192.168.0.10', max_requests=10, redis_pool=redis_pool):\n        return '200 OK'\n    except TooManyRequests:\n      return '429 Too Many Requests'\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEvoluxBR%2Fpython-redis-rate-limit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FEvoluxBR%2Fpython-redis-rate-limit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEvoluxBR%2Fpython-redis-rate-limit/lists"}