style: clean up unused parameters and imports in examples
This commit is contained in:
@@ -346,7 +346,7 @@ def create_app_with_config() -> FastAPI:
|
||||
)
|
||||
|
||||
@app.exception_handler(RateLimitExceeded)
|
||||
async def rate_limit_handler(_: Request, exc: RateLimitExceeded) -> JSONResponse:
|
||||
async def _rate_limit_handler(_: Request, exc: RateLimitExceeded) -> JSONResponse:
|
||||
return JSONResponse(
|
||||
status_code=429,
|
||||
content={
|
||||
@@ -358,17 +358,17 @@ def create_app_with_config() -> FastAPI:
|
||||
|
||||
@app.get("/")
|
||||
@rate_limit(limit=10, window_size=60)
|
||||
async def root(_: Request) -> dict[str, str]:
|
||||
async def _root(_: Request) -> dict[str, str]:
|
||||
return {"message": "Hello from config-loaded app!"}
|
||||
|
||||
@app.get("/health")
|
||||
async def health() -> dict[str, str]:
|
||||
async def _health() -> dict[str, str]:
|
||||
"""Health check - exempt from rate limiting."""
|
||||
return {"status": "healthy"}
|
||||
|
||||
@app.get("/api/data")
|
||||
@rate_limit(limit=50, window_size=60)
|
||||
async def get_data(_: Request) -> dict[str, str]:
|
||||
async def _get_data(_: Request) -> dict[str, str]:
|
||||
return {"data": "Some API data"}
|
||||
|
||||
return app
|
||||
|
||||
Reference in New Issue
Block a user