[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 eaa694fb7d

Closes https://github.com/searxng/searxng/security/code-scanning/276
Closes https://github.com/searxng/searxng/security/dependabot/37
This commit is contained in:
Ivan Gabaldon 2025-11-06 10:09:10 +01:00 committed by GitHub
parent b1918dd121
commit 7af922c9df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 3 additions and 36 deletions

View File

@ -1 +1,2 @@
granian==2.5.6 granian==2.5.6
granian[pname]==2.5.6

View File

@ -9,8 +9,6 @@ python-dateutil==2.9.0.post0
pyyaml==6.0.3 pyyaml==6.0.3
httpx[http2]==0.28.1 httpx[http2]==0.28.1
httpx-socks[asyncio]==0.10.0 httpx-socks[asyncio]==0.10.0
Brotli==1.1.0
setproctitle==1.3.7
valkey==6.1.1 valkey==6.1.1
markdown-it-py==3.0.0 markdown-it-py==3.0.0
fasttext-predict==0.9.2.4 fasttext-predict==0.9.2.4

View File

@ -10,7 +10,6 @@ from os.path import dirname, abspath
import logging import logging
import msgspec import msgspec
import searx.unixthreadname # pylint: disable=unused-import
# Debug # Debug
LOG_FORMAT_DEBUG: str = '%(levelname)-7s %(name)-30.30s: %(message)s' LOG_FORMAT_DEBUG: str = '%(levelname)-7s %(name)-30.30s: %(message)s'

View File

@ -201,7 +201,6 @@ def fetch_traits(engine_traits: EngineTraits):
"User-Agent": gen_useragent(), "User-Agent": gen_useragent(),
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "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-Language": "en-US;q=0.5,en;q=0.3",
"Accept-Encoding": "gzip, deflate, br",
"DNT": "1", "DNT": "1",
"Connection": "keep-alive", "Connection": "keep-alive",
"Upgrade-Insecure-Requests": "1", "Upgrade-Insecure-Requests": "1",

View File

@ -198,9 +198,6 @@ time_range_map: dict[str, str] = {
def request(query: str, params: dict[str, t.Any]) -> None: 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] = { args: dict[str, t.Any] = {
'q': query, 'q': query,
'source': 'web', 'source': 'web',
@ -436,14 +433,11 @@ def fetch_traits(engine_traits: EngineTraits):
engine_traits.custom["ui_lang"] = {} engine_traits.custom["ui_lang"] = {}
headers = {
'Accept-Encoding': 'gzip, deflate',
}
lang_map = {'no': 'nb'} # norway lang_map = {'no': 'nb'} # norway
# languages (UI) # languages (UI)
resp = get('https://search.brave.com/settings', headers=headers) resp = get('https://search.brave.com/settings')
if not resp.ok: # type: ignore if not resp.ok: # type: ignore
print("ERROR: response from Brave is not OK.") print("ERROR: response from Brave is not OK.")
@ -472,7 +466,7 @@ def fetch_traits(engine_traits: EngineTraits):
# search regions of brave # 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 if not resp.ok: # type: ignore
print("ERROR: response from Brave is not OK.") print("ERROR: response from Brave is not OK.")

View File

@ -73,7 +73,6 @@ def request(query, params):
params['headers'].update( params['headers'].update(
{ {
'Connection': 'keep-alive', 'Connection': 'keep-alive',
'Accept-Encoding': 'gzip, defalte, br',
'Host': 'tineye.com', 'Host': 'tineye.com',
'DNT': '1', 'DNT': '1',
'TE': 'trailers', 'TE': 'trailers',

View File

@ -82,7 +82,6 @@ def _download_and_check_if_image(image_url: str) -> bool:
'User-Agent': gen_useragent(), 'User-Agent': gen_useragent(),
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', '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-Language': 'en-US;q=0.5,en;q=0.3',
'Accept-Encoding': 'gzip, deflate, br',
'DNT': '1', 'DNT': '1',
'Connection': 'keep-alive', 'Connection': 'keep-alive',
'Upgrade-Insecure-Requests': '1', 'Upgrade-Insecure-Requests': '1',

View File

@ -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

View File

@ -1040,7 +1040,6 @@ def image_proxy():
request_headers = { request_headers = {
'User-Agent': gen_useragent(), 'User-Agent': gen_useragent(),
'Accept': 'image/webp,*/*', 'Accept': 'image/webp,*/*',
'Accept-Encoding': 'gzip, deflate',
'Sec-GPC': '1', 'Sec-GPC': '1',
'DNT': '1', 'DNT': '1',
} }