yes.
This commit is contained in:
parent
92d2e900bb
commit
9e335902bb
1 changed files with 15 additions and 0 deletions
15
main.py
15
main.py
|
@ -156,6 +156,19 @@ def get_access_token():
|
||||||
else:
|
else:
|
||||||
token = token_info["access_token"]
|
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__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
@ -164,6 +177,8 @@ if __name__ == "__main__":
|
||||||
while True:
|
while True:
|
||||||
drawCanvas()
|
drawCanvas()
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
|
if(is_token_expired()):
|
||||||
|
get_access_token()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue