flip_api.main

Attributes

_cors_allowed_origins

API_PREFIX

_docs_enabled

app

ROUTERS

Functions

lifespan(→ collections.abc.AsyncGenerator[None, None])

Start scheduler and populate CORS allowlist from Cognito callback URLs.

rate_limit_exceeded_handler(...)

include_api_routers(→ None)

Mount all API routes under the shared /api namespace.

root(→ dict[str, str])

Root endpoint to verify the API is running.

health_check(→ dict[str, str])

Health check endpoint to verify the API is running.

main(→ None)

Entry point for the application script

Module Contents

flip_api.main._cors_allowed_origins: list[str] = []
async flip_api.main.lifespan(app: fastapi.FastAPI) collections.abc.AsyncGenerator[None, None]

Start scheduler and populate CORS allowlist from Cognito callback URLs.

Parameters:

app (FastAPI) – The FastAPI application instance being started.

flip_api.main.API_PREFIX = '/api'
flip_api.main._docs_enabled = True
flip_api.main.app
async flip_api.main.rate_limit_exceeded_handler(request: fastapi.Request, exc: slowapi.errors.RateLimitExceeded) fastapi.responses.JSONResponse
flip_api.main.ROUTERS: tuple[fastapi.APIRouter, Ellipsis]
flip_api.main.include_api_routers(fastapi_app: fastapi.FastAPI) None

Mount all API routes under the shared /api namespace.

Parameters:

fastapi_app (FastAPI) – The FastAPI application to attach the routers to.

flip_api.main.root() dict[str, str]

Root endpoint to verify the API is running.

Returns:

A welcome message.

Return type:

dict[str, str]

flip_api.main.health_check() dict[str, str]

Health check endpoint to verify the API is running.

Returns:

{"status": "ok", "message": "flip is running"}.

Return type:

dict[str, str]

flip_api.main.main() None

Entry point for the application script