+ resp.status = 503
+
+ loglib.log().comment('Aborted: Query took too long to process.')
+ logdata = loglib.get_and_disable()
+ if logdata:
+ resp.text = logdata
+ resp.content_type = 'text/html; charset=utf-8'
+ else:
+ resp.text = "Query took too long to process."
+ resp.content_type = 'text/plain; charset=utf-8'
+
+
+class ParamWrapper(api_impl.ASGIAdaptor):
+ """ Adaptor class for server glue to Falcon framework.
+ """
+
+ def __init__(self, req: Request, resp: Response,
+ config: Configuration) -> None:
+ self.request = req
+ self.response = resp
+ self._config = config
+
+
+ def get(self, name: str, default: Optional[str] = None) -> Optional[str]:
+ return cast(Optional[str], self.request.get_param(name, default=default))
+
+
+ def get_header(self, name: str, default: Optional[str] = None) -> Optional[str]:
+ return cast(Optional[str], self.request.get_header(name, default=default))
+
+
+ def error(self, msg: str, status: int = 400) -> HTTPNominatimError:
+ return HTTPNominatimError(msg, status, self.content_type)
+
+
+ def create_response(self, status: int, output: str, num_results: int) -> None:
+ self.response.context.num_results = num_results
+ self.response.status = status
+ self.response.text = output
+ self.response.content_type = self.content_type
+