{"id":30707087,"url":"https://github.com/hallazzang/asyncio-throttle","last_synced_at":"2025-09-02T20:14:35.469Z","repository":{"id":44930637,"uuid":"107075746","full_name":"hallazzang/asyncio-throttle","owner":"hallazzang","description":"Simple, easy-to-use throttler for asyncio.","archived":false,"fork":false,"pushed_at":"2022-07-12T12:50:31.000Z","size":22,"stargazers_count":125,"open_issues_count":3,"forks_count":13,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-08-15T23:50:07.185Z","etag":null,"topics":["asyncio","python","throttle","throttler","throttling"],"latest_commit_sha":null,"homepage":null,"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/hallazzang.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}},"created_at":"2017-10-16T03:51:50.000Z","updated_at":"2025-08-13T09:49:30.000Z","dependencies_parsed_at":"2022-08-27T23:11:58.005Z","dependency_job_id":null,"html_url":"https://github.com/hallazzang/asyncio-throttle","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/hallazzang/asyncio-throttle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hallazzang%2Fasyncio-throttle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hallazzang%2Fasyncio-throttle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hallazzang%2Fasyncio-throttle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hallazzang%2Fasyncio-throttle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hallazzang","download_url":"https://codeload.github.com/hallazzang/asyncio-throttle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hallazzang%2Fasyncio-throttle/sbom","scorecard":{"id":453554,"data":{"date":"2025-08-11","repo":{"name":"github.com/hallazzang/asyncio-throttle","commit":"268783c564949dc5e5e34c3ef9cf35409cdccfe6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 2/25 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 4 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T08:53:03.684Z","repository_id":44930637,"created_at":"2025-08-19T08:53:03.684Z","updated_at":"2025-08-19T08:53:03.684Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273341747,"owners_count":25088419,"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","status":"online","status_checked_at":"2025-09-02T02:00:09.530Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","python","throttle","throttler","throttling"],"created_at":"2025-09-02T20:14:29.006Z","updated_at":"2025-09-02T20:14:35.460Z","avatar_url":"https://github.com/hallazzang.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# asyncio-throttle\n\n[![travis-ci](https://travis-ci.org/hallazzang/asyncio-throttle.svg?branch=master)](https://travis-ci.org/hallazzang/asyncio-throttle)\n[![shields-pypi-badge]](https://pypi.org/project/asyncio-throttle/)\n\n[shields-pypi-badge]: https://img.shields.io/pypi/v/asyncio-throttle?style=flat-square\u0026color=blue\n\nSimple, easy-to-use throttler for asyncio.\n\n## Example\n\n```python\nimport time\nimport random\nimport asyncio\n\nfrom asyncio_throttle import Throttler\n\nasync def worker(no, throttler, n):\n    for _ in range(n):\n        await asyncio.sleep(random.random() * 2)\n\n        async with throttler:\n            print(time.time(), 'Worker #%d: Bang!' % no)\n\nasync def main():\n    throttler = Throttler(rate_limit=5)\n\n    tasks = [\n        loop.create_task(worker(no, throttler, 10))\n            for no in range(5)\n    ]\n    await asyncio.wait(tasks)\n\nloop = asyncio.get_event_loop()\nloop.run_until_complete(main())\nloop.close()\n```\n\nHere I limited work rate to 5/sec while there are 5 workers.\nAnd the result:\n\n```plain\n1508273760.3462772 Worker #2: Bang!\n1508273760.590009 Worker #3: Bang!\n1508273760.856431 Worker #0: Bang!\n1508273761.0110679 Worker #2: Bang!\n1508273761.086856 Worker #4: Bang!\n1508273761.350699 Worker #3: Bang!\n1508273761.5906 Worker #1: Bang!\n1508273761.8655958 Worker #4: Bang!\n1508273762.224158 Worker #0: Bang!\n1508273762.600234 Worker #2: Bang!\n1508273762.694332 Worker #2: Bang!\n1508273762.726774 Worker #0: Bang!\n1508273762.944273 Worker #4: Bang!\n```\n\n## Installation\n\n```bash\n$ pip install asyncio-throttle\n```\n\nIt requires Python 3.6 or later.\n\n## Usage\n\n`asyncio_throttle.Throttler` introduces simple APIs: `flush()` and\n`acquire()`. But you will not be interested in those because you can\njust use it within `with` statement and it looks nicer.\n\nFirst, create a throttler given desired rate limit. For example if you\nwant to limit rate to 500/min, you can make it as:\n\n```python\nfrom asyncio_throttle import Throttler\n\nthrottler = Throttler(rate_limit=500, period=60)\n```\n\nThen whenever you want to do some jobs which should have limited\nrate(e.g. sending request to server), Put it in `async with` statement:\n\n```python\nasync with throttler:\n    send_a_request()\n```\n\nIt's that easy. `asyncio_throttler` can be easily integrated with\n`aiohttp` too:\n\n```python\nasync def worker(throttler, session):\n    while True:\n        async with throttler:\n            async with session.get('http://example.com') as resp:\n                do_some_job_with(await resp.text())\n\n        await asyncio.sleep(0.05)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhallazzang%2Fasyncio-throttle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhallazzang%2Fasyncio-throttle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhallazzang%2Fasyncio-throttle/lists"}