mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
[prep] indent Wikipedia functions
This commit indents the methods from the wikipedia engine so that the following refactoring commit has a clean diff.
This commit is contained in:
parent
5dd28ff04b
commit
1e97bfab70
1 changed files with 52 additions and 52 deletions
|
@ -25,16 +25,16 @@ supported_languages_url = 'https://meta.wikimedia.org/wiki/List_of_Wikipedias'
|
|||
language_variants = {"zh": ("zh-cn", "zh-hk", "zh-mo", "zh-my", "zh-sg", "zh-tw")}
|
||||
|
||||
|
||||
# set language in base_url
|
||||
def url_lang(lang):
|
||||
# set language in base_url
|
||||
def url_lang(lang):
|
||||
lang_pre = lang.split('-')[0]
|
||||
if lang_pre == 'all' or lang_pre not in supported_languages and lang_pre not in language_aliases:
|
||||
return 'en'
|
||||
return match_language(lang, supported_languages, language_aliases).split('-')[0]
|
||||
|
||||
|
||||
# do search-request
|
||||
def request(query, params):
|
||||
# do search-request
|
||||
def request(query, params):
|
||||
if query.islower():
|
||||
query = query.title()
|
||||
|
||||
|
@ -51,8 +51,8 @@ def request(query, params):
|
|||
return params
|
||||
|
||||
|
||||
# get response from search-request
|
||||
def response(resp):
|
||||
# get response from search-request
|
||||
def response(resp):
|
||||
if resp.status_code == 404:
|
||||
return []
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue