summaryrefslogtreecommitdiff
path: root/searx/engines/wikipedia.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2022-08-01 17:01:59 +0200
committerMarkus Heiser <markus.heiser@darmarit.de>2022-08-01 17:01:59 +0200
commit8df1f0c47e03fe7525c40a2856dba950bab8998b (patch)
tree844dc7ca4d31f0ff97c07d1817dbfba591420b30 /searx/engines/wikipedia.py
parenta2badb4fe47eaa6df26b7bc0ef601cb9179edc3a (diff)
downloadsearxng-8df1f0c47e03fe7525c40a2856dba950bab8998b.tar.gz
searxng-8df1f0c47e03fe7525c40a2856dba950bab8998b.zip
[mod] add 'Accept-Language' HTTP header to online processores
Most engines that support languages (and regions) use the Accept-Language from the WEB browser to build a response that fits to the language (and region). - add new engine option: send_accept_language_header Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/engines/wikipedia.py')
-rw-r--r--searx/engines/wikipedia.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/searx/engines/wikipedia.py b/searx/engines/wikipedia.py
index cc806a8de..52b1053ed 100644
--- a/searx/engines/wikipedia.py
+++ b/searx/engines/wikipedia.py
@@ -19,6 +19,9 @@ about = {
"results": 'JSON',
}
+
+send_accept_language_header = True
+
# search-url
search_url = 'https://{language}.wikipedia.org/api/rest_v1/page/summary/{title}'
supported_languages_url = 'https://meta.wikimedia.org/wiki/List_of_Wikipedias'
@@ -41,9 +44,6 @@ def request(query, params):
language = url_lang(params['language'])
params['url'] = search_url.format(title=quote(query), language=language)
- if params['language'].lower() in language_variants.get(language, []):
- params['headers']['Accept-Language'] = params['language'].lower()
-
params['headers']['User-Agent'] = searx_useragent()
params['raise_for_httperror'] = False
params['soft_max_redirects'] = 2