{ "info": { "author": "", "author_email": "", "bugtrack_url": null, "classifiers": [], "description": "python-redis-rate-limit\n=======================\n\n.. image:: https://travis-ci.org/EvoluxBR/python-redis-rate-limit.svg?branch=master\n :target: https://travis-ci.org/EvoluxBR/python-redis-rate-limit\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\nThis lib offers an abstraction of a Rate Limit algorithm implemented on top of\nRedis >= 2.6.0.\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: 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'", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "tds-python-redis-rate-limit", "package_url": "https://pypi.org/project/tds-python-redis-rate-limit/", "platform": "", "project_url": "https://pypi.org/project/tds-python-redis-rate-limit/", "project_urls": null, "release_url": "https://pypi.org/project/tds-python-redis-rate-limit/0.0.6/", "requires_dist": null, "requires_python": "", "summary": "Python Rate Limiter based on Redis.", "version": "0.0.6" }, "last_serial": 3670183, "releases": { "0.0.6": [ { "comment_text": "", "digests": { "md5": "74b419436d651cc6ba73f8d86edad7dc", "sha256": "e1c73cdae9d156a2ddc180cad5271a2764ab2815323be646f44511052893ade5" }, "downloads": -1, "filename": "tds-python-redis-rate-limit-0.0.6.tar.gz", "has_sig": false, "md5_digest": "74b419436d651cc6ba73f8d86edad7dc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3379, "upload_time": "2018-03-14T20:00:14", "url": "https://files.pythonhosted.org/packages/1f/3e/cf146168278d92af3d7330fa12099eb8d7e03673526c858c758c84bf4a94/tds-python-redis-rate-limit-0.0.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "74b419436d651cc6ba73f8d86edad7dc", "sha256": "e1c73cdae9d156a2ddc180cad5271a2764ab2815323be646f44511052893ade5" }, "downloads": -1, "filename": "tds-python-redis-rate-limit-0.0.6.tar.gz", "has_sig": false, "md5_digest": "74b419436d651cc6ba73f8d86edad7dc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3379, "upload_time": "2018-03-14T20:00:14", "url": "https://files.pythonhosted.org/packages/1f/3e/cf146168278d92af3d7330fa12099eb8d7e03673526c858c758c84bf4a94/tds-python-redis-rate-limit-0.0.6.tar.gz" } ] }