mirror of
https://github.com/c0de-archive/spotipy.git
synced 2024-11-05 07:27:47 +00:00
Support both Python 2 & 3 base64 library
This commit is contained in:
parent
a3a68be7bc
commit
a541b3bb81
@ -62,6 +62,10 @@ class SpotifyClientCredentials(object):
|
|||||||
"""Gets client credentials access token """
|
"""Gets client credentials access token """
|
||||||
payload = { 'grant_type': 'client_credentials'}
|
payload = { 'grant_type': 'client_credentials'}
|
||||||
|
|
||||||
|
if sys.version_info[0] >= 3: # Python 3
|
||||||
|
auth_header = base64.b64encode(str(self.client_id + ':' + self.client_secret).encode())
|
||||||
|
headers = {'Authorization': 'Basic %s' % auth_header.decode()}
|
||||||
|
else: # Python 2
|
||||||
auth_header = base64.b64encode(self.client_id + ':' + self.client_secret)
|
auth_header = base64.b64encode(self.client_id + ':' + self.client_secret)
|
||||||
headers = {'Authorization': 'Basic %s' % auth_header}
|
headers = {'Authorization': 'Basic %s' % auth_header}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user