from typing import Optional, Mapping, cast, Any
from pathlib import Path
-import falcon
from falcon.asgi import App, Request, Response
from nominatim.api import NominatimAPIAsync
self.content_type = content_type
-async def nominatim_error_handler(req: Request, resp: Response,
+async def nominatim_error_handler(req: Request, resp: Response, #pylint: disable=unused-argument
exception: HTTPNominatimError,
_: Any) -> None:
+ """ Special error handler that passes message and content type as
+ per exception info.
+ """
resp.status = exception.status
resp.text = exception.msg
resp.content_type = exception.content_type
app.add_route(f"/{name}.php", endpoint)
return app
+
+
+def run_wsgi() -> App:
+ """ Entry point for uvicorn.
+
+ Make sure uvicorn is run from the project directory.
+ """
+ return get_application(Path('.'))