device-manager.app.main#

Main file for the device manager service.

Attributes#

Functions#

lifespan(app)

Define fastapi app lifespan.

custom_http_exception_handler(→ fastapi.Response)

Add logging for http exceptions.

validation_exception_handler(→ fastapi.Response)

Add logging for FastAPI's automatic input validation exceptions.

readiness(→ dict)

Readiness health endpoint.

Module Contents#

async device-manager.app.main.lifespan(app: fastapi.FastAPI)#

Define fastapi app lifespan.

device-manager.app.main.app#
device-manager.app.main.origins = ['http://localhost:8080', 'https://localhost:8443']#
async device-manager.app.main.custom_http_exception_handler(request: fastapi.Request, exc: starlette.exceptions.HTTPException) fastapi.Response#

Add logging for http exceptions.

https://fastapi.tiangolo.com/tutorial/handling-errors/#reuse-fastapis-exception-handlers

async device-manager.app.main.validation_exception_handler(request: fastapi.Request, exc: fastapi.exceptions.RequestValidationError) fastapi.Response#

Add logging for FastAPI’s automatic input validation exceptions.

https://fastapi.tiangolo.com/tutorial/handling-errors/#reuse-fastapis-exception-handlers

async device-manager.app.main.readiness() dict#

Readiness health endpoint.

Inspects SQLAlchemy engine and checks if the device table exists.