From e8706fb738da9feb21e596f403dddb40e69c8a7b Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sun, 25 Jun 2023 12:37:31 +0200 Subject: [fix] engine & network issues / documentation and type annotations This patch fixes some quirks and issues related to the engines and the network. Each engine has its own network and this network was broken for the following engines[1]: - archlinux - bing - dailymotion - duckduckgo - google - peertube - startpage - wikipedia Since the files have been touched anyway, the type annotaions of the engine modules has also been completed so that error messages from the type checker are no longer reported. Related and (partial) fixed issue: - [1] https://github.com/searxng/searxng/issues/762#issuecomment-1605323861 - [2] https://github.com/searxng/searxng/issues/2513 - [3] https://github.com/searxng/searxng/issues/2515 Signed-off-by: Markus Heiser --- searx/engines/wikipedia.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'searx/engines/wikipedia.py') diff --git a/searx/engines/wikipedia.py b/searx/engines/wikipedia.py index 98b3d6f9e..b4b70208d 100644 --- a/searx/engines/wikipedia.py +++ b/searx/engines/wikipedia.py @@ -61,7 +61,7 @@ import babel from lxml import html from searx import utils -from searx import network +from searx import network as _network from searx import locales from searx.enginelib.traits import EngineTraits @@ -180,7 +180,7 @@ def response(resp): ): return [] - network.raise_for_httperror(resp) + _network.raise_for_httperror(resp) api_result = resp.json() title = utils.html_to_text(api_result.get('titles', {}).get('display') or api_result.get('title')) @@ -267,7 +267,7 @@ def fetch_wikimedia_traits(engine_traits: EngineTraits): for sxng_tag in sxng_tag_list: engine_traits.regions[sxng_tag] = eng_tag - resp = network.get(list_of_wikipedias) + resp = _network.get(list_of_wikipedias) if not resp.ok: print("ERROR: response from Wikipedia is not OK.") -- cgit v1.2.3