summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authorIvan Gabaldon <igabaldon@inetol.net>2025-11-06 10:09:10 +0100
committerGitHub <noreply@github.com>2025-11-06 10:09:10 +0100
commit7af922c9dfff6e60974eb2dfcb1399f4573820f4 (patch)
treefc717f4037f5d82e1fe59b9ff5cf31f77f15729d /searx
parentb1918dd12110c183fc1fba1c51778a32e6cb4049 (diff)
[enh] py: drop deps (#5407)
The difference between decompression with brotli or gzip in HTML files is negligible for 3 MB of compiled binary package. Introduced in https://github.com/searxng/searxng/commit/eaa694fb7d0e47b943bc6d6edb6cb6a40ab2d85e Closes https://github.com/searxng/searxng/security/code-scanning/276 Closes https://github.com/searxng/searxng/security/dependabot/37
Diffstat (limited to 'searx')
-rw-r--r--searx/__init__.py1
-rw-r--r--searx/engines/bing.py1
-rw-r--r--searx/engines/brave.py10
-rw-r--r--searx/engines/tineye.py1
-rw-r--r--searx/search/checker/impl.py1
-rw-r--r--searx/unixthreadname.py21
-rwxr-xr-xsearx/webapp.py1
7 files changed, 2 insertions, 34 deletions
diff --git a/searx/__init__.py b/searx/__init__.py
index 5ee367d70..8977bac67 100644
--- a/searx/__init__.py
+++ b/searx/__init__.py
@@ -10,7 +10,6 @@ from os.path import dirname, abspath
import logging
import msgspec
-import searx.unixthreadname # pylint: disable=unused-import
# Debug
LOG_FORMAT_DEBUG: str = '%(levelname)-7s %(name)-30.30s: %(message)s'
diff --git a/searx/engines/bing.py b/searx/engines/bing.py
index a359ccdfd..4a1934a2d 100644
--- a/searx/engines/bing.py
+++ b/searx/engines/bing.py
@@ -201,7 +201,6 @@ def fetch_traits(engine_traits: EngineTraits):
"User-Agent": gen_useragent(),
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"Accept-Language": "en-US;q=0.5,en;q=0.3",
- "Accept-Encoding": "gzip, deflate, br",
"DNT": "1",
"Connection": "keep-alive",
"Upgrade-Insecure-Requests": "1",
diff --git a/searx/engines/brave.py b/searx/engines/brave.py
index c1148b889..fe8fb616b 100644
--- a/searx/engines/brave.py
+++ b/searx/engines/brave.py
@@ -198,9 +198,6 @@ time_range_map: dict[str, str] = {
def request(query: str, params: dict[str, t.Any]) -> None:
- # Don't accept br encoding / see https://github.com/searxng/searxng/pull/1787
- params['headers']['Accept-Encoding'] = 'gzip, deflate'
-
args: dict[str, t.Any] = {
'q': query,
'source': 'web',
@@ -436,14 +433,11 @@ def fetch_traits(engine_traits: EngineTraits):
engine_traits.custom["ui_lang"] = {}
- headers = {
- 'Accept-Encoding': 'gzip, deflate',
- }
lang_map = {'no': 'nb'} # norway
# languages (UI)
- resp = get('https://search.brave.com/settings', headers=headers)
+ resp = get('https://search.brave.com/settings')
if not resp.ok: # type: ignore
print("ERROR: response from Brave is not OK.")
@@ -472,7 +466,7 @@ def fetch_traits(engine_traits: EngineTraits):
# search regions of brave
- resp = get('https://cdn.search.brave.com/serp/v2/_app/immutable/chunks/parameters.734c106a.js', headers=headers)
+ resp = get('https://cdn.search.brave.com/serp/v2/_app/immutable/chunks/parameters.734c106a.js')
if not resp.ok: # type: ignore
print("ERROR: response from Brave is not OK.")
diff --git a/searx/engines/tineye.py b/searx/engines/tineye.py
index 0dbea0fc1..2150e8f59 100644
--- a/searx/engines/tineye.py
+++ b/searx/engines/tineye.py
@@ -73,7 +73,6 @@ def request(query, params):
params['headers'].update(
{
'Connection': 'keep-alive',
- 'Accept-Encoding': 'gzip, defalte, br',
'Host': 'tineye.com',
'DNT': '1',
'TE': 'trailers',
diff --git a/searx/search/checker/impl.py b/searx/search/checker/impl.py
index cf1f03449..354cbadc7 100644
--- a/searx/search/checker/impl.py
+++ b/searx/search/checker/impl.py
@@ -82,7 +82,6 @@ def _download_and_check_if_image(image_url: str) -> bool:
'User-Agent': gen_useragent(),
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Language': 'en-US;q=0.5,en;q=0.3',
- 'Accept-Encoding': 'gzip, deflate, br',
'DNT': '1',
'Connection': 'keep-alive',
'Upgrade-Insecure-Requests': '1',
diff --git a/searx/unixthreadname.py b/searx/unixthreadname.py
deleted file mode 100644
index b335b1650..000000000
--- a/searx/unixthreadname.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# SPDX-License-Identifier: AGPL-3.0-or-later
-"""
-if setproctitle is installed.
-set Unix thread name with the Python thread name
-"""
-
-try:
- import setproctitle
-except ImportError:
- pass
-else:
- import threading
-
- old_thread_init = threading.Thread.__init__
-
- def new_thread_init(self, *args, **kwargs):
- # pylint: disable=protected-access, disable=c-extension-no-member
- old_thread_init(self, *args, **kwargs)
- setproctitle.setthreadtitle(self._name)
-
- threading.Thread.__init__ = new_thread_init
diff --git a/searx/webapp.py b/searx/webapp.py
index d7bb37717..c1857dd87 100755
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -1040,7 +1040,6 @@ def image_proxy():
request_headers = {
'User-Agent': gen_useragent(),
'Accept': 'image/webp,*/*',
- 'Accept-Encoding': 'gzip, deflate',
'Sec-GPC': '1',
'DNT': '1',
}