Spaces:
Sleeping
Sleeping
fix: clean up rate limit handler — alias slowapi import, rename wrapper to handle_rate_limit
Browse files- app/api/main.py +4 -2
app/api/main.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
from app.api.routes import router
|
| 4 |
-
from slowapi import _rate_limit_exceeded_handler
|
| 5 |
from slowapi.errors import RateLimitExceeded
|
| 6 |
from app.api.limiter import limiter
|
| 7 |
import os
|
|
@@ -9,9 +9,11 @@ from prometheus_fastapi_instrumentator import Instrumentator
|
|
| 9 |
from starlette.requests import Request
|
| 10 |
from starlette.responses import Response
|
| 11 |
|
| 12 |
-
|
|
|
|
| 13 |
return await _slowapi_handler(request, exc) # type: ignore[arg-type]
|
| 14 |
|
|
|
|
| 15 |
app = FastAPI(
|
| 16 |
title="AI Code Review Agent",
|
| 17 |
description="Multi-agent AI platform that simulates a software engineering team",
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
from app.api.routes import router
|
| 4 |
+
from slowapi import _rate_limit_exceeded_handler as _slowapi_handler
|
| 5 |
from slowapi.errors import RateLimitExceeded
|
| 6 |
from app.api.limiter import limiter
|
| 7 |
import os
|
|
|
|
| 9 |
from starlette.requests import Request
|
| 10 |
from starlette.responses import Response
|
| 11 |
|
| 12 |
+
|
| 13 |
+
async def handle_rate_limit(request: Request, exc: Exception) -> Response:
|
| 14 |
return await _slowapi_handler(request, exc) # type: ignore[arg-type]
|
| 15 |
|
| 16 |
+
|
| 17 |
app = FastAPI(
|
| 18 |
title="AI Code Review Agent",
|
| 19 |
description="Multi-agent AI platform that simulates a software engineering team",
|