|
|
|
|
@ -40,19 +40,18 @@ log = logging.getLogger(__name__)
|
|
|
|
|
# we configure the logging level and format
|
|
|
|
|
configure_logging()
|
|
|
|
|
|
|
|
|
|
# we define the exception handlers
|
|
|
|
|
exception_handlers = {Exception: handle_exception}
|
|
|
|
|
|
|
|
|
|
# we create the ASGI for the app
|
|
|
|
|
app = FastAPI(exception_handlers=exception_handlers, openapi_url="", title="LCCA API",
|
|
|
|
|
app = FastAPI(openapi_url="", title="LCCA API",
|
|
|
|
|
description="Welcome to LCCA's API documentation!",
|
|
|
|
|
version="0.1.0")
|
|
|
|
|
app.state.limiter = limiter
|
|
|
|
|
app.add_exception_handler(RateLimitExceeded, _rate_limit_exceeded_handler)
|
|
|
|
|
|
|
|
|
|
# we define the exception handlers
|
|
|
|
|
app.add_exception_handler(Exception, handle_exception)
|
|
|
|
|
app.add_exception_handler(HTTPException, handle_exception)
|
|
|
|
|
app.add_exception_handler(StarletteHTTPException, handle_exception)
|
|
|
|
|
app.add_exception_handler(RequestValidationError, handle_exception)
|
|
|
|
|
app.add_exception_handler(SQLAlchemyError, handle_exception)
|
|
|
|
|
app.add_middleware(GZipMiddleware, minimum_size=2000)
|
|
|
|
|
app.add_exception_handler(RateLimitExceeded, _rate_limit_exceeded_handler)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from src.context import set_request_id, reset_request_id, get_request_id
|
|
|
|
|
|