mirror of
https://github.com/searxng/searxng.git
synced 2025-07-23 05:09:17 +02:00
[format.python] initial formatting of the python code
This patch was generated by black [1]:: make format.python [1] https://github.com/psf/black Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
fcdc2c2cd2
commit
3d96a9839a
184 changed files with 2800 additions and 2836 deletions
|
@ -39,8 +39,7 @@ def request(query, params):
|
|||
query = query.title()
|
||||
|
||||
language = url_lang(params['language'])
|
||||
params['url'] = search_url.format(title=quote(query),
|
||||
language=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()
|
||||
|
@ -63,8 +62,10 @@ def response(resp):
|
|||
except:
|
||||
pass
|
||||
else:
|
||||
if api_result['type'] == 'https://mediawiki.org/wiki/HyperSwitch/errors/bad_request' \
|
||||
and api_result['detail'] == 'title-invalid-characters':
|
||||
if (
|
||||
api_result['type'] == 'https://mediawiki.org/wiki/HyperSwitch/errors/bad_request'
|
||||
and api_result['detail'] == 'title-invalid-characters'
|
||||
):
|
||||
return []
|
||||
|
||||
raise_for_httperror(resp)
|
||||
|
@ -81,11 +82,15 @@ def response(resp):
|
|||
|
||||
results.append({'url': wikipedia_link, 'title': title})
|
||||
|
||||
results.append({'infobox': title,
|
||||
'id': wikipedia_link,
|
||||
'content': api_result.get('extract', ''),
|
||||
'img_src': api_result.get('thumbnail', {}).get('source'),
|
||||
'urls': [{'title': 'Wikipedia', 'url': wikipedia_link}]})
|
||||
results.append(
|
||||
{
|
||||
'infobox': title,
|
||||
'id': wikipedia_link,
|
||||
'content': api_result.get('extract', ''),
|
||||
'img_src': api_result.get('thumbnail', {}).get('source'),
|
||||
'urls': [{'title': 'Wikipedia', 'url': wikipedia_link}],
|
||||
}
|
||||
)
|
||||
|
||||
return results
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue