[fix] update_ahmia_blacklist.py - User-Agent become required

The User-Agent header recently become required to fetch blacklist from URL

  https://ahmia.fi/blacklist/

[1] https://github.com/searxng/searxng/actions/runs/18892940199/job/53924400294

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2025-10-29 08:15:28 +01:00 committed by Markus Heiser
parent 6a2196c03d
commit c48993452f

View File

@ -18,10 +18,10 @@ URL = 'https://ahmia.fi/blacklist/banned/'
def fetch_ahmia_blacklist():
resp = requests.get(URL, timeout=3.0)
resp = requests.get(URL, timeout=3.0, headers={"User-Agent": "SearXNG"})
if resp.status_code != 200:
# pylint: disable=broad-exception-raised
raise Exception("Error fetching Ahmia blacklist, HTTP code " + resp.status_code) # type: ignore
raise Exception("Error fetching Ahmia blacklist, HTTP code " + str(resp.status_code))
return resp.text.split()