summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2024-01-20 17:48:21 +0100
committerAnton Khirnov <anton@khirnov.net>2024-01-20 17:54:07 +0100
commitfe4ace18bb0b499dc000fc9abb8eb8bdee6065e3 (patch)
treed38a06f7119dfa54e93fae95e214108ad08a3177
parent047c7a7cf6d5ffc6df062ff4b9e6b71126dee063 (diff)
Make it work with debian packages.HEADmaster
-rw-r--r--searx/botdetection/config.py4
-rw-r--r--searx/network/client.py6
-rw-r--r--searx/utils.py1
-rwxr-xr-xsearx/webapp.py2
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):