Extended Types¶
This module implements the type extensions applied by SearXNG.
- flask.requestis replaced by- sxng_request
- flask.Requestis replaced by- SXNG_Request
- httpx.responseis replaced by- SXNG_Response
- searx.extended_types.sxng_request: SXNG_Request¶
- A replacement for - flask.requestwith type cast- SXNG_Request.
- class searx.extended_types.SXNG_Request(environ: WSGIEnvironment, populate_request: bool = True, shallow: bool = False)[source]¶
- SearXNG extends the class - flask.Requestwith properties from this class definition, see type cast- sxng_request.- preferences: searx.preferences.Preferences¶
- The prefernces of the request. 
 - start_time: float¶
- Start time of the request, - timeit.default_timeradded by- searx.webappto calculate the total time of the request.
 
- class searx.extended_types.SXNG_Response(status_code: int, *, headers: Headers | Mapping[str, str] | Mapping[bytes, bytes] | Sequence[Tuple[str, str]] | Sequence[Tuple[bytes, bytes]] | None = None, content: str | bytes | Iterable[bytes] | AsyncIterable[bytes] | None = None, text: str | None = None, html: str | None = None, json: Any = None, stream: SyncByteStream | AsyncByteStream | None = None, request: Request | None = None, extensions: Mapping[str, Any] | None = None, history: List[Response] | None = None, default_encoding: str | Callable[[bytes], str] = 'utf-8')[source]¶
- SearXNG extends the class - httpx.Responsewith properties from this class (type cast of- httpx.Response).- response = httpx.get("https://example.org") response = typing.cast(SXNG_Response, response) if response.ok: ...