mirror of
https://github.com/searxng/searxng.git
synced 2025-07-16 09:49:21 +02:00
[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>
This commit is contained in:
parent
a2badb4fe4
commit
8df1f0c47e
21 changed files with 52 additions and 26 deletions
|
@ -30,6 +30,7 @@ about = {
|
|||
categories = ['map']
|
||||
paging = False
|
||||
language_support = True
|
||||
send_accept_language_header = True
|
||||
|
||||
# search-url
|
||||
base_url = 'https://nominatim.openstreetmap.org/'
|
||||
|
@ -142,9 +143,8 @@ def request(query, params):
|
|||
params['url'] = base_url + search_string.format(query=urlencode({'q': query}))
|
||||
params['route'] = route_re.match(query)
|
||||
params['headers']['User-Agent'] = searx_useragent()
|
||||
|
||||
accept_language = 'en' if params['language'] == 'all' else params['language']
|
||||
params['headers']['Accept-Language'] = accept_language
|
||||
if 'Accept-Language' not in params['headers']:
|
||||
params['headers']['Accept-Language'] = 'en'
|
||||
return params
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue