mirror of
https://github.com/searxng/searxng.git
synced 2025-12-22 19:50:00 +00: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:
@@ -42,9 +42,10 @@ def request(query, params):
|
||||
r = http_post(
|
||||
'https://accounts.spotify.com/api/token',
|
||||
data={'grant_type': 'client_credentials'},
|
||||
headers={'Authorization': 'Basic ' + base64.b64encode(
|
||||
"{}:{}".format(api_client_id, api_client_secret).encode()
|
||||
).decode()}
|
||||
headers={
|
||||
'Authorization': 'Basic '
|
||||
+ base64.b64encode("{}:{}".format(api_client_id, api_client_secret).encode()).decode()
|
||||
},
|
||||
)
|
||||
j = loads(r.text)
|
||||
params['headers'] = {'Authorization': 'Bearer {}'.format(j.get('access_token'))}
|
||||
@@ -63,18 +64,12 @@ def response(resp):
|
||||
if result['type'] == 'track':
|
||||
title = result['name']
|
||||
url = result['external_urls']['spotify']
|
||||
content = '{} - {} - {}'.format(
|
||||
result['artists'][0]['name'],
|
||||
result['album']['name'],
|
||||
result['name'])
|
||||
content = '{} - {} - {}'.format(result['artists'][0]['name'], result['album']['name'], result['name'])
|
||||
|
||||
embedded = embedded_url.format(audioid=result['id'])
|
||||
|
||||
# append result
|
||||
results.append({'url': url,
|
||||
'title': title,
|
||||
'embedded': embedded,
|
||||
'content': content})
|
||||
results.append({'url': url, 'title': title, 'embedded': embedded, 'content': content})
|
||||
|
||||
# return results
|
||||
return results
|
||||
|
||||
Reference in New Issue
Block a user