Skip to content

Commit c5c64fa

Browse files
committed
enable passing kwargs to fastapi.Fastapi()
1 parent 25a40ae commit c5c64fa

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

ogc_api_processes_fastapi/main.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""API routes registration and initialization."""
22

33
import typing
4-
from typing import Callable
4+
from typing import Any, Callable
55

66
import fastapi
77
import pydantic
@@ -60,8 +60,26 @@ def instantiate_app(
6060
exception_handler: Callable[
6161
[fastapi.Request, exceptions.OGCAPIException], fastapi.responses.JSONResponse
6262
] = exceptions.ogc_api_exception_handler,
63+
**kwargs: Any,
6364
) -> fastapi.FastAPI:
64-
app = fastapi.FastAPI()
65+
"""Instantiate FastAPI application.
66+
67+
Parameters
68+
----------
69+
client : clients.BaseClient
70+
Client to be used for API requests.
71+
exception_handler : Callable[[fastapi.Request, exceptions.OGCAPIException],
72+
fastapi.responses.JSONResponse], optional
73+
Exception handler, by default exceptions.ogc_api_exception_handler
74+
**kwargs : Any
75+
Additional parameters passed to `fastapi.Fastapi()`.
76+
77+
Returns
78+
-------
79+
fastapi.FastAPI
80+
FastAPI application.
81+
"""
82+
app = fastapi.FastAPI(**kwargs)
6583
router = instantiate_router(client)
6684
app.include_router(router)
6785
app = exceptions.include_exception_handlers(app, exception_handler)

0 commit comments

Comments
 (0)