From 44c9ec100b8962c5cf626bc42ae6477dc5b71e14 Mon Sep 17 00:00:00 2001 From: novatorem Date: Fri, 11 Sep 2020 17:18:40 -0400 Subject: [PATCH] Debugging KeyError --- api/spotify.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/api/spotify.py b/api/spotify.py index 66cd1a0..d0abdd1 100644 --- a/api/spotify.py +++ b/api/spotify.py @@ -38,9 +38,14 @@ def refreshToken(): } headers = {"Authorization": "Basic {}".format(getAuth())} - response = requests.post(REFRESH_TOKEN_URL, data=data, headers=headers) - return response.json()["access_token"] + + try: + return response.json()["access_token"] + except KeyError: + print(json.dumps(response.json())) + print("\n---\n") + raise KeyError(str(response.json())) def recentlyPlayed():