1

I want to rate limiter endpoint in my app with 10 requests per second. I have seen this question Ratelimit in Fastapi, but i cant understand how i should do in my project, because i have multiple files. My main.py

from .router import router

from fastapi import FastAPI


def get_application() -> FastAPI:
    application = FastAPI()

    application.include_router(router)

    return application


app = get_application()

and router.py

from fastapi import APIRouter

router = APIRouter()

@router.get("/")
async def some_func(...):
    #some code

So, how can i rate limiter my methods from router.py?

python_user
  • 5,375
  • 2
  • 13
  • 32
Blz
  • 21
  • 2
  • no, it doesnt, because i need to add @limiter.limit() at router.py if it possible – Blz May 12 '23 at 14:34

0 Answers0