on master help sign in
Fix some more errors with none/wrong credentials
b2e1ee80xhtml
searx/engines/spotify.py+3−3
@@ -38,12 +38,12 @@ def request(query, params):
38 r = requests.post(
38 r = requests.post(
39 'https://accounts.spotify.com/api/token',
39 'https://accounts.spotify.com/api/token',
40 data={'grant_type': 'client_credentials'},
40 data={'grant_type': 'client_credentials'},
41− headers={'Authorization': 'Basic ' + str(base64.b64encode(
41+ headers={'Authorization': 'Basic ' + base64.b64encode(
42 "{}:{}".format(api_client_id, api_client_secret).encode('utf-8')
42 "{}:{}".format(api_client_id, api_client_secret).encode('utf-8')
43− ), 'utf-8')}
43+ ).decode('utf-8')}
44 )
44 )
45 j = loads(r.text)
45 j = loads(r.text)
46− params['headers'] = {'Authorization': 'Bearer ' + j['access_token']}
46+ params['headers'] = {'Authorization': 'Bearer {}'.format(j.get('access_token'))}
47
47
48 return params
48 return params
49
49