mirror of
https://github.com/searxng/searxng.git
synced 2025-11-20 05:23:09 -05:00
[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:
parent
6a2196c03d
commit
c48993452f
@ -18,10 +18,10 @@ URL = 'https://ahmia.fi/blacklist/banned/'
|
|||||||
|
|
||||||
|
|
||||||
def fetch_ahmia_blacklist():
|
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:
|
if resp.status_code != 200:
|
||||||
# pylint: disable=broad-exception-raised
|
# 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()
|
return resp.text.split()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user