INNER CODE UNIT · Python

lifespan

felipeall/transfermarkt-api · app/main.py:34

async def lifespan(app: FastAPI) -> AsyncIterator[None]:
    """Create the shared tfmkt client on startup and close it on shutdown."""
    app.state.tfmkt = TfmktClient()
    yield
    await app.state.tfmkt.aclose()


app = FastAPI(
    title="Transfermarkt API",
    version="4.2.0",
    description="Football data from Transfermarkt's JSON API: players, clubs and competitions.",
    lifespan=lifespan,
)
# health checks and the interactive docs (the root redirect, Swagger UI and the schema it loads) are not counted
RATE_LIMIT_EXEMPT_PATHS = {
    "/",
    "/health",
    *filter(None, (app.docs_url, app.swagger_ui_oauth2_redirect_url, app.redoc_url, app.openapi_url)),

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…