Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 7c9c1124 authored by Markus Heiser's avatar Markus Heiser Committed by GitHub
Browse files

Merge pull request #1560 from return42/http-accept-language

[mod] add 'Accept-Language' HTTP header to online processores
parents 1fbb514a 8df1f0c4
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -440,6 +440,7 @@ engine is shown. Most of the options have a default value or even are optional.
     engine: example
     shortcut: demo
     base_url: 'https://{language}.example.com/'
     send_accept_language_header: false
     categories: general
     timeout: 3.0
     api_key: 'apikey'
@@ -488,6 +489,13 @@ engine is shown. Most of the options have a default value or even are optional.
  use multiple sites using only one engine, or updating the site URL without
  touching at the code.

``send_accept_language_header`` :
  Several engines that support languages (or regions) deal with the HTTP header
  ``Accept-Language`` to build a response that fits to the locale.  When this
  option is activated, the language (locale) that is selected by the user is used
  to build and send a ``Accept-Language`` header in the request to the origin
  search engine.

``categories`` : optional
  Define in which categories this engine will be active.  Most of the time, it is
  defined in the code of the engine, but in a few cases it is useful, like when
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ ENGINE_DEFAULT_ARGS = {
    "enable_http": False,
    "using_tor_proxy": False,
    "display_error_messages": True,
    "send_accept_language_header": False,
    "tokens": [],
    "about": {},
}
+1 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ categories = ['general', 'web']
paging = True
time_range_support = False
safesearch = False
send_accept_language_header = True
supported_languages_url = 'https://www.bing.com/account/general'
language_aliases = {}

@@ -68,7 +69,6 @@ def request(query, params):
        logger.debug("headers.Referer --> %s", referer)

    params['url'] = base_url + search_path
    params['headers']['Accept-Language'] = "en-US,en;q=0.5"
    params['headers']['Accept'] = 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
    return params

+1 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ categories = ['images', 'web']
paging = True
safesearch = True
time_range_support = True
send_accept_language_header = True
supported_languages_url = 'https://www.bing.com/account/general'
number_of_results = 28

+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ about = {
categories = ['news']
paging = True
time_range_support = True
send_accept_language_header = True

# search-url
base_url = 'https://www.bing.com/'
Loading