{"id":31859494,"url":"https://github.com/python-ellar/ellar-throttler","last_synced_at":"2025-10-12T15:26:02.610Z","repository":{"id":101294580,"uuid":"606774324","full_name":"python-ellar/ellar-throttler","owner":"python-ellar","description":"A rate limiting module for Ellar","archived":false,"fork":false,"pushed_at":"2025-02-01T00:57:13.000Z","size":844,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-29T14:58:46.494Z","etag":null,"topics":[],"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/python-ellar.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-26T14:30:19.000Z","updated_at":"2024-11-08T21:25:50.000Z","dependencies_parsed_at":"2024-03-21T00:24:27.925Z","dependency_job_id":"a9194d8b-8c9e-4493-9c86-cd4484f72e1b","html_url":"https://github.com/python-ellar/ellar-throttler","commit_stats":null,"previous_names":["python-ellar/ellar-throttler","eadwincode/ellar-throttler"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/python-ellar/ellar-throttler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-ellar%2Fellar-throttler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-ellar%2Fellar-throttler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-ellar%2Fellar-throttler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-ellar%2Fellar-throttler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/python-ellar","download_url":"https://codeload.github.com/python-ellar/ellar-throttler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-ellar%2Fellar-throttler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279011851,"owners_count":26085004,"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-10-12T02:00:06.719Z","response_time":53,"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":[],"created_at":"2025-10-12T15:25:58.686Z","updated_at":"2025-10-12T15:26:02.603Z","avatar_url":"https://github.com/python-ellar.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"#\" target=\"blank\"\u003e\u003cimg src=\"https://python-ellar.github.io/ellar/img/EllarLogoB.png\" width=\"200\" alt=\"Ellar Logo\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003eEllar - Python ASGI web framework for building fast, efficient, and scalable RESTful APIs and server-side applications.\u003c/p\u003e\n\n![Test](https://github.com/python-ellar/ellar-throttler/actions/workflows/test_full.yml/badge.svg)\n![Coverage](https://img.shields.io/codecov/c/github/python-ellar/ellar-throttler)\n[![PyPI version](https://badge.fury.io/py/ellar-throttler.svg)](https://badge.fury.io/py/ellar-throttler)\n[![PyPI version](https://img.shields.io/pypi/v/ellar-throttler.svg)](https://pypi.python.org/pypi/ellar-throttler)\n[![PyPI version](https://img.shields.io/pypi/pyversions/ellar-throttler.svg)](https://pypi.python.org/pypi/ellar-throttler)\n\n## Introduction\nA rate limit module for Ellar\n\n## Installation\n```shell\n$(venv) pip install ellar-throttler\n```\n\n## Configure ThrottlerModule\nWe need to set up the `ThrottlerModule` to be able for configuring throttling mechanisms for the entire application.\n\n```python\nfrom ellar.common import Module\nfrom ellar_throttler import AnonymousThrottler, ThrottlerModule, UserThrottler\n\n\n@Module(\n    modules=(\n        ThrottlerModule.setup(\n            throttlers=[\n                AnonymousThrottler(limit=100, ttl=60*5), # 100 requests per 5mins\n                UserThrottler(limit=1000, ttl=60*60*24) # 1000 requests per day\n            ]\n        ),\n    )\n)\nclass AppModule:\n    pass\n```\n\n## Applying Throttling to Controllers\n\n```python\nfrom ellar.common import Controller, get\nfrom ellar_throttler import Throttle, AnonymousThrottler, UserThrottler\nfrom ellar.di import injectable\n\n\n@injectable()\nclass AppService:\n    def success(self, use_auth: bool):\n        message = \"success\"\n        if use_auth:\n            message += \" for Authenticated user\"\n        return {message: True}\n\n    def ignored(self, use_auth: bool):\n        message = \"ignored\"\n        if use_auth:\n            message += \" for Authenticated user\"\n        return {message: True}\n\n\n@Throttle(intercept=True)\n@Controller(\"/limit\")\nclass LimitController:\n    def __init__(self, app_service: AppService):\n        self.app_service = app_service\n\n    @get()\n    def get_throttled(self, use_auth: bool):\n        return self.app_service.success(use_auth)\n\n    @get(\"/shorter\")\n    @Throttle(anon={\"limit\": 3, \"ttl\": 5}, user={\"limit\": 3, \"ttl\": 3}) # overriding anon and user throttler config\n    def get_shorter(self, use_auth: bool):\n        return self.app_service.success(use_auth)\n\n    @get(\"/shorter-inline-throttling\")\n    @Throttle(AnonymousThrottler(ttl=5, limit=3), UserThrottler(ttl=3, limit=3)) # overriding global throttling options\n    def get_shorter_inline_version(self, use_auth: bool):\n        return self.app_service.success(use_auth)\n```\n\n## References\n- [Documentation](https://python-ellar.github.io/ellar/techniques/rate-limit)\n\n## License\nEllar is [MIT licensed](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-ellar%2Fellar-throttler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpython-ellar%2Fellar-throttler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-ellar%2Fellar-throttler/lists"}