{"id":20607278,"url":"https://github.com/byunjuneseok/fastapi-frl","last_synced_at":"2025-04-15T03:55:08.148Z","repository":{"id":57428495,"uuid":"457605061","full_name":"byunjuneseok/fastapi-frl","owner":"byunjuneseok","description":"⚡️⏲ Rate limiter library for FastAPI. (Work in progress..)","archived":false,"fork":false,"pushed_at":"2022-03-30T13:49:36.000Z","size":574,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-15T03:54:59.920Z","etag":null,"topics":["aioredis","fastapi","python3","rate-limiter","rate-limiting","redis"],"latest_commit_sha":null,"homepage":"https://byunjuneseok.github.io/fastapi-frl/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/byunjuneseok.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":"2022-02-10T02:40:51.000Z","updated_at":"2023-12-22T13:00:44.000Z","dependencies_parsed_at":"2022-09-02T17:23:07.788Z","dependency_job_id":null,"html_url":"https://github.com/byunjuneseok/fastapi-frl","commit_stats":null,"previous_names":["byunjuneseok/fastapi-rate-limiter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byunjuneseok%2Ffastapi-frl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byunjuneseok%2Ffastapi-frl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byunjuneseok%2Ffastapi-frl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byunjuneseok%2Ffastapi-frl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/byunjuneseok","download_url":"https://codeload.github.com/byunjuneseok/fastapi-frl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249003953,"owners_count":21196794,"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":["aioredis","fastapi","python3","rate-limiter","rate-limiting","redis"],"created_at":"2024-11-16T10:06:14.061Z","updated_at":"2025-04-15T03:55:08.130Z","avatar_url":"https://github.com/byunjuneseok.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fastapi-frl\n[![pypi](https://img.shields.io/pypi/v/fastapi-frl.svg)](https://pypi.python.org/pypi/fastapi-frl)\n[![versions](https://img.shields.io/pypi/pyversions/fastapi-frl.svg)](https://pypi.org/project/fastapi-frl/)\n\nRate limiter library for FastAPI.\n\n![diagram](./static/diagram.png)\n\n## Prerequisite\n- Redis server\n\n## Installation\n```shell\npip install fastapi-frl\n```\n## Getting Started\n\n```python3\nfrom fastapi import APIRouter, Depends, FastAPI\n\nfrom fastapi_frl import LimiterBackend, Limiter\nfrom fastapi_frl.algorithms import SimpleAlgorithm, SlidingWindowCounter\nfrom fastapi_frl.key import KeyByIP, KeyByPath\n\napp = FastAPI()\n\n# You only need to initialize backend of limiter once.\nlimiter_backend = LimiterBackend('redis://localhost')\n\n# Define the limiter.\nlimiter = Limiter(\n    name='hello_world_limiter',\n    algorithm=SimpleAlgorithm(threshold=10),\n    key_generator=KeyByIP()\n)\n\n# Apply it to a single api endpoint.\n@app.get('/', status_code=200, dependencies=[Depends(limiter)])\nasync def hello_world():\n    return {'message': 'Hello World'}\n\n# You can define multiple limiter with different rules.\napi_book_limiter = Limiter(\n    name='api_book_limiter',\n    algorithm=SlidingWindowCounter(10, 10),\n    key_generator=KeyByPath(),\n)\n\n# Also, you can apply it to the api router.\napi_book_router = APIRouter(prefix='/books', tags=['Book'], dependencies=[Depends(api_book_limiter)])\n\n...\n\napp.include_router(api_book_router)\n\n```\n\n## Documentation\nThe API documentation is in progress.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyunjuneseok%2Ffastapi-frl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbyunjuneseok%2Ffastapi-frl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyunjuneseok%2Ffastapi-frl/lists"}