Fix style errors in Qwant engine

This commit is contained in:
Noémi Ványi 2021-10-10 21:13:55 +02:00
parent 263db54aa9
commit a0fb8ebeaf
1 changed files with 8 additions and 7 deletions

View File

@ -61,6 +61,7 @@ category_to_keyword = {
# search-url # search-url
url = 'https://api.qwant.com/v3/search/{keyword}?q={query}&count={count}&offset={offset}' url = 'https://api.qwant.com/v3/search/{keyword}?q={query}&count={count}&offset={offset}'
def request(query, params): def request(query, params):
"""Qwant search request""" """Qwant search request"""
keyword = category_to_keyword[categories[0]] keyword = category_to_keyword[categories[0]]
@ -77,10 +78,10 @@ def request(query, params):
offset = min(offset, 40) offset = min(offset, 40)
params['url'] = url.format( params['url'] = url.format(
keyword = keyword, keyword=keyword,
query = urlencode({'q': query}), query=urlencode({'q': query}),
offset = offset, offset=offset,
count = count, count=count,
) )
# add language tag # add language tag
@ -129,7 +130,7 @@ def response(resp):
# result['items']. # result['items'].
mainline = data.get('result', {}).get('items', []) mainline = data.get('result', {}).get('items', [])
mainline = [ mainline = [
{'type' : keyword, 'items' : mainline }, {'type': keyword, 'items': mainline},
] ]
# return empty array if there are no results # return empty array if there are no results
@ -217,8 +218,8 @@ def response(resp):
'publishedDate': pub_date, 'publishedDate': pub_date,
'thumbnail': thumbnail, 'thumbnail': thumbnail,
'template': 'videos.html', 'template': 'videos.html',
'length': length, 'length': length,
}) })
return results return results