|
|
|
|
@ -34,7 +34,7 @@ from src.enums import ResponseStatus
|
|
|
|
|
from src.exceptions import handle_exception
|
|
|
|
|
from src.app_logging import configure_logging
|
|
|
|
|
from src.middleware import RequestValidationMiddleware, RequestTimeoutMiddleware
|
|
|
|
|
from src.rate_limiter import limiter
|
|
|
|
|
# from src.rate_limiter import limiter
|
|
|
|
|
from fastapi.exceptions import RequestValidationError
|
|
|
|
|
from starlette.exceptions import HTTPException as StarletteHTTPException
|
|
|
|
|
from src.csrf_protect import csrf_protect
|
|
|
|
|
@ -74,7 +74,7 @@ app.add_exception_handler(StarletteHTTPException, handle_exception)
|
|
|
|
|
app.add_exception_handler(RequestValidationError, handle_exception)
|
|
|
|
|
app.add_exception_handler(RateLimitExceeded, _sync_rate_limit_handler)
|
|
|
|
|
|
|
|
|
|
app.state.limiter = limiter
|
|
|
|
|
# app.state.limiter = limiter
|
|
|
|
|
app.add_middleware(GZipMiddleware, minimum_size=1000)
|
|
|
|
|
app.add_middleware(SlowAPIMiddleware)
|
|
|
|
|
app.add_middleware(RequestTimeoutMiddleware, timeout=REQUEST_TIMEOUT_SECONDS)
|
|
|
|
|
|