mirror of
https://github.com/c0de-archive/spotipy.git
synced 2024-11-05 07:27:47 +00:00
Fixes for the remaining base64 lib references
This commit is contained in:
parent
a541b3bb81
commit
c944cc772f
@ -197,9 +197,12 @@ class SpotifyOAuth(object):
|
|||||||
if self.state:
|
if self.state:
|
||||||
payload['state'] = self.state
|
payload['state'] = self.state
|
||||||
|
|
||||||
|
if sys.version_info[0] >= 3: # Python 3
|
||||||
auth_header = base64.b64encode(str(self.client_id + ':' + self.client_secret).encode())
|
auth_header = base64.b64encode(str(self.client_id + ':' + self.client_secret).encode())
|
||||||
headers = {'Authorization': 'Basic %s' % auth_header.decode()}
|
headers = {'Authorization': 'Basic %s' % auth_header.decode()}
|
||||||
|
else: # Python 2
|
||||||
|
auth_header = base64.b64encode(self.client_id + ':' + self.client_secret)
|
||||||
|
headers = {'Authorization': 'Basic %s' % auth_header}
|
||||||
|
|
||||||
response = requests.post(self.OAUTH_TOKEN_URL, data=payload,
|
response = requests.post(self.OAUTH_TOKEN_URL, data=payload,
|
||||||
headers=headers, verify=True)
|
headers=headers, verify=True)
|
||||||
@ -222,8 +225,12 @@ class SpotifyOAuth(object):
|
|||||||
payload = { 'refresh_token': refresh_token,
|
payload = { 'refresh_token': refresh_token,
|
||||||
'grant_type': 'refresh_token'}
|
'grant_type': 'refresh_token'}
|
||||||
|
|
||||||
auth_header = base64.b64encode(bytes(self.client_id + ':' + self.client_secret, encoding='utf-8'))
|
if sys.version_info[0] >= 3: # Python 3
|
||||||
headers = {'Authorization': 'Basic %s' % auth_header.decode('ascii')}
|
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)
|
||||||
|
headers = {'Authorization': 'Basic %s' % auth_header}
|
||||||
|
|
||||||
response = requests.post(self.OAUTH_TOKEN_URL, data=payload,
|
response = requests.post(self.OAUTH_TOKEN_URL, data=payload,
|
||||||
headers=headers)
|
headers=headers)
|
||||||
|
Loading…
Reference in New Issue
Block a user