mirror of
https://github.com/THIS-IS-NOT-A-BACKUP/zspotify.git
synced 2025-07-01 23:33:11 +00:00
fix KeyError in premium check
Seems as though the product key can be left out in some cases, so check if it exists beforehand.
This commit is contained in:
parent
0c266038c7
commit
2d501ff501
@ -249,7 +249,7 @@ def getSongInfo(songId):
|
|||||||
def checkPremium(access_token):
|
def checkPremium(access_token):
|
||||||
headers = {'Authorization': f'Bearer {access_token}'}
|
headers = {'Authorization': f'Bearer {access_token}'}
|
||||||
resp = requests.get('https://api.spotify.com/v1/me', headers=headers).json()
|
resp = requests.get('https://api.spotify.com/v1/me', headers=headers).json()
|
||||||
if resp["product"] == "premium":
|
if "product" in resp and resp["product"] == "premium":
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user