auto reload on failure
This commit is contained in:
@@ -89,10 +89,13 @@ def callback():
|
||||
def appdata():
|
||||
global access_token
|
||||
stime = time.time()
|
||||
user_headers = {
|
||||
"Authorization": "Bearer " + access_token,
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
try:
|
||||
user_headers = {
|
||||
"Authorization": "Bearer " + access_token,
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
except NameError:
|
||||
return { 'reload': True }
|
||||
|
||||
currently_playing = requests.get("https://api.spotify.com/v1/me/player/currently-playing", headers=user_headers)
|
||||
if currently_playing.content:
|
||||
@@ -100,8 +103,7 @@ def appdata():
|
||||
print("QUICK" + str(time.time() - stime))
|
||||
return { 'progress_ms': currently_playing.json()["progress_ms"],
|
||||
}
|
||||
elif currently_playing.json()["is_playing"] is True and currently_playing.json()["item"]["id"] != request.args.get('id'):
|
||||
|
||||
elif currently_playing.json()["is_playing"] is True and currently_playing.json()["item"]["id"] != request.args.get('id'):
|
||||
print("FULL" + str(time.time() - stime))
|
||||
return { 'id': currently_playing.json()["item"]["id"],
|
||||
'name': currently_playing.json()["item"]["name"],
|
||||
|
||||
Reference in New Issue
Block a user