token-bucket


Nametoken-bucket JSON
Version 0.3.0 PyPI version JSON
download
home_pagehttps://github.com/falconry/token-bucket
SummaryVery fast implementation of the token bucket algorithm.
upload_time2021-06-30 17:39:44
maintainer
docs_urlNone
authorkgriffs
requires_python>=3.5
licenseApache 2.0
keywords web http https cloud rate limiting token bucket throttling
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            |Build Status| |PyPi| |codecov.io|

A Token Bucket Implementation for Python Web Apps
=================================================

The ``token-bucket`` package provides an implementation of the
`token bucket algorithm <https://en.wikipedia.org/wiki/Token_bucket>`_
suitable for use in web applications for shaping or policing request
rates. This implementation does not require the use of an independent
timer thread to manage the bucket state.

Compared to other rate-limiting algorithms that use a simple counter,
the token bucket algorithm provides the following advantages:

* The thundering herd problem is avoided since bucket capacity is
  replenished gradually, rather than being immediately refilled at the
  beginning of each epoch as is common with simple fixed window
  counters.
* Burst duration can be explicitly controlled

Moving window algorithms are resistant to bursting, but at the cost of
additional processing and memory overhead vs. the token bucket
algorithm which uses a simple, fast counter per key. The latter approach
does allow for bursting, but only for a controlled duration.

.. |Build Status| image:: https://github.com/falconry/token-bucket/workflows/tests/badge.svg
   :target: https://github.com/falconry/token-bucket/actions?query=workflow%3A%22tests%22

.. |PyPi| image:: https://img.shields.io/pypi/v/token-bucket.svg
   :target: https://pypi.python.org/pypi/token-bucket

.. |codecov.io| image:: https://codecov.io/gh/falconry/token-bucket/branch/master/graph/badge.svg
   :target: https://codecov.io/gh/falconry/token-bucket



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/falconry/token-bucket",
    "name": "token-bucket",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": "",
    "keywords": "web http https cloud rate limiting token bucket throttling",
    "author": "kgriffs",
    "author_email": "mail@kgriffs.com",
    "download_url": "https://files.pythonhosted.org/packages/b7/6d/386ed0cfb7f3c2e0311a96b3884a2ba98a7b958344f51c7cce0b1c7bbb0f/token_bucket-0.3.0.tar.gz",
    "platform": "",
    "description": "|Build Status| |PyPi| |codecov.io|\n\nA Token Bucket Implementation for Python Web Apps\n=================================================\n\nThe ``token-bucket`` package provides an implementation of the\n`token bucket algorithm <https://en.wikipedia.org/wiki/Token_bucket>`_\nsuitable for use in web applications for shaping or policing request\nrates. This implementation does not require the use of an independent\ntimer thread to manage the bucket state.\n\nCompared to other rate-limiting algorithms that use a simple counter,\nthe token bucket algorithm provides the following advantages:\n\n* The thundering herd problem is avoided since bucket capacity is\n  replenished gradually, rather than being immediately refilled at the\n  beginning of each epoch as is common with simple fixed window\n  counters.\n* Burst duration can be explicitly controlled\n\nMoving window algorithms are resistant to bursting, but at the cost of\nadditional processing and memory overhead vs. the token bucket\nalgorithm which uses a simple, fast counter per key. The latter approach\ndoes allow for bursting, but only for a controlled duration.\n\n.. |Build Status| image:: https://github.com/falconry/token-bucket/workflows/tests/badge.svg\n   :target: https://github.com/falconry/token-bucket/actions?query=workflow%3A%22tests%22\n\n.. |PyPi| image:: https://img.shields.io/pypi/v/token-bucket.svg\n   :target: https://pypi.python.org/pypi/token-bucket\n\n.. |codecov.io| image:: https://codecov.io/gh/falconry/token-bucket/branch/master/graph/badge.svg\n   :target: https://codecov.io/gh/falconry/token-bucket\n\n\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "Very fast implementation of the token bucket algorithm.",
    "version": "0.3.0",
    "project_urls": {
        "Homepage": "https://github.com/falconry/token-bucket"
    },
    "split_keywords": [
        "web",
        "http",
        "https",
        "cloud",
        "rate",
        "limiting",
        "token",
        "bucket",
        "throttling"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4bce61ee52521766059d2c2537e85ba5f9773313e74b86df14652a61dd2e990e",
                "md5": "e242207ee93a8ff65b8dbd1a2a4af891",
                "sha256": "6df24309e3cf5b808ae5ef714a3191ec5b54f48c34ef959e4882eef140703369"
            },
            "downloads": -1,
            "filename": "token_bucket-0.3.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e242207ee93a8ff65b8dbd1a2a4af891",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.5",
            "size": 9459,
            "upload_time": "2021-06-30T17:39:42",
            "upload_time_iso_8601": "2021-06-30T17:39:42.943459Z",
            "url": "https://files.pythonhosted.org/packages/4b/ce/61ee52521766059d2c2537e85ba5f9773313e74b86df14652a61dd2e990e/token_bucket-0.3.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b76d386ed0cfb7f3c2e0311a96b3884a2ba98a7b958344f51c7cce0b1c7bbb0f",
                "md5": "111c6213775be10e01196b75d862e3ae",
                "sha256": "979571c99db2ff9e651f2b2146a62b2ebadf7de6c217a8781698282976cb675f"
            },
            "downloads": -1,
            "filename": "token_bucket-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "111c6213775be10e01196b75d862e3ae",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 6735,
            "upload_time": "2021-06-30T17:39:44",
            "upload_time_iso_8601": "2021-06-30T17:39:44.314057Z",
            "url": "https://files.pythonhosted.org/packages/b7/6d/386ed0cfb7f3c2e0311a96b3884a2ba98a7b958344f51c7cce0b1c7bbb0f/token_bucket-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-06-30 17:39:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "falconry",
    "github_project": "token-bucket",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "token-bucket"
}
        
Elapsed time: 0.14062s