master
Lukas Schulz 2020-12-20 02:21:46 +01:00
parent 92d2e900bb
commit 9e335902bb
1 changed files with 15 additions and 0 deletions

15
main.py
View File

@ -156,6 +156,19 @@ def get_access_token():
else:
token = token_info["access_token"]
def is_token_expired():
sp_oauth = spotipy.SpotifyOAuth(
client_id,
client_secret,
redirect_uri,
scope=scope,
#cache_path=cache_path,
username=username,
open_browser=False
)
token_info = sp_oauth.get_cached_token()
return token_info.is_token_expired()
if __name__ == "__main__":
main()
@ -164,6 +177,8 @@ if __name__ == "__main__":
while True:
drawCanvas()
time.sleep(10)
if(is_token_expired()):
get_access_token()