Source code for

from ...__about__ import __version__
from .routers import resources, user, types
from fastapi_jwt_auth.exceptions import AuthJWTException
from fastapi import Request
from fastapi.responses import JSONResponse

from fastapi import FastAPI

app = FastAPI(
    title="TARDIS REST API",
        "name": "Matterminers",
        "url": "",
        "email": "",
        "name": "MIT License",
        "url": "",
            "name": "resources",
            "description": "Information about the currently managed resources.",
            "name": "user",
            "description": "Handles login, refresh tokens, logout and anything related to the user.",  # noqa B509

# the jwt auth package returns 422 on failed auth which doens't make sense
# This code changes that. There is currently an issue running: # noqa B950
[docs]@app.exception_handler(AuthJWTException) def authjwt_exception_handler(request: Request, exc: AuthJWTException): detail = exc.message if detail == "Signature verification failed" or detail == "Signature has expired": exc.status_code = 401 return JSONResponse(status_code=exc.status_code, content={"detail": detail})
app.include_router(resources.router) app.include_router(user.router) app.include_router(types.router)