diff options
| author | Noémi Ványi <kvch@users.noreply.github.com> | 2020-09-12 14:51:35 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-12 14:51:35 +0200 |
| commit | 2370234d0978f59dd62efa4a4931e41ad31444d1 (patch) | |
| tree | d3863e22b3d34092484146ce0bdc6e0ca8d36216 /searx/engines/spotify.py | |
| parent | 272158944bf13503e2597018fc60a00baddec660 (diff) | |
| parent | bdac99d4f0349a71d7ecb9a4c61687356afedd6b (diff) | |
Merge pull request #2137 from dalf/drop-python-2
Drop Python 2
Diffstat (limited to 'searx/engines/spotify.py')
| -rw-r--r-- | searx/engines/spotify.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/searx/engines/spotify.py b/searx/engines/spotify.py index 00c395706..74942326e 100644 --- a/searx/engines/spotify.py +++ b/searx/engines/spotify.py @@ -11,7 +11,7 @@ """ from json import loads -from searx.url_utils import urlencode +from urllib.parse import urlencode import requests import base64 @@ -39,8 +39,8 @@ def request(query, params): 'https://accounts.spotify.com/api/token', data={'grant_type': 'client_credentials'}, headers={'Authorization': 'Basic ' + base64.b64encode( - "{}:{}".format(api_client_id, api_client_secret).encode('utf-8') - ).decode('utf-8')} + "{}:{}".format(api_client_id, api_client_secret).encode() + ).decode()} ) j = loads(r.text) params['headers'] = {'Authorization': 'Bearer {}'.format(j.get('access_token'))} @@ -59,7 +59,7 @@ def response(resp): if result['type'] == 'track': title = result['name'] url = result['external_urls']['spotify'] - content = u'{} - {} - {}'.format( + content = '{} - {} - {}'.format( result['artists'][0]['name'], result['album']['name'], result['name']) |