diff options
-rw-r--r-- | searx/botdetection/config.py | 4 | ||||
-rw-r--r-- | searx/network/client.py | 6 | ||||
-rw-r--r-- | searx/utils.py | 1 | ||||
-rwxr-xr-x | searx/webapp.py | 2 |
4 files changed, 9 insertions, 4 deletions
diff --git a/searx/botdetection/config.py b/searx/botdetection/config.py index d2710456..2a536d17 100644 --- a/searx/botdetection/config.py +++ b/searx/botdetection/config.py @@ -14,7 +14,7 @@ import copy import typing import logging import pathlib -import pytomlpp as toml +import toml __all__ = ['Config', 'UNSET', 'SchemaIssue'] @@ -72,7 +72,7 @@ class Config: log.debug("load config file: %s", cfg_file) try: upd_cfg = toml.load(cfg_file) - except toml.DecodeError as exc: + except toml.TomlDecodeError as exc: msg = str(exc).replace('\t', '').replace('\n', ' ') log.error("%s: %s", cfg_file, msg) raise diff --git a/searx/network/client.py b/searx/network/client.py index 23826c75..d819139b 100644 --- a/searx/network/client.py +++ b/searx/network/client.py @@ -10,7 +10,11 @@ import threading from typing import Any, Dict import httpx -from httpx_socks import AsyncProxyTransport +#from httpx_socks import AsyncProxyTransport +class AsyncProxyTransport: + def __init__(self, *args, **kwargs): + raise NotImplementedError + from python_socks import parse_proxy_url, ProxyConnectionError, ProxyTimeoutError, ProxyError from searx import logger diff --git a/searx/utils.py b/searx/utils.py index c009c314..c835ba83 100644 --- a/searx/utils.py +++ b/searx/utils.py @@ -653,6 +653,7 @@ def detect_language(text: str, threshold: float = 0.3, only_search_languages: bo .. _`FastText.zip: Compressing text classification models`: https://arxiv.org/abs/1612.03651 """ + return None if not isinstance(text, str): raise ValueError('text must a str') r = _get_fasttext_model().predict(text.replace('\n', ' '), k=1, threshold=threshold) diff --git a/searx/webapp.py b/searx/webapp.py index 53ca9678..7570cc33 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -188,7 +188,7 @@ def get_locale(): return locale -babel = Babel(app, locale_selector=get_locale) +babel = Babel(app) def _get_browser_language(req, lang_list): |