Skip to content

SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.

[fix] presearch - AttributeError: 'NoneType' object has no attribute 'territory' (#5687)

Markus Heisereea189286388
diff --git a/searx/engines/presearch.py b/searx/engines/presearch.py
index 141b292ab..55bf16adb 100644
--- a/searx/engines/presearch.py
+++ b/searx/engines/presearch.py
@@ -137,7 +137,7 @@ def _get_request_id(query, params):
# performs an IP-based geolocation of the user, we don't want that in
# SearXNG ;-)
- if l.territory:
+ if l and l.territory:
headers['Accept-Language'] = f"{l.language}-{l.territory},{l.language};" "q=0.9,*;" "q=0.5"
resp = get(url, headers=headers, timeout=5)