yes.
This commit is contained in:
parent
951ce1ccb2
commit
3a8e65f5e1
1 changed files with 1 additions and 18 deletions
19
main.py
19
main.py
|
@ -221,29 +221,12 @@ def get_access_token():
|
|||
code = sp_oauth.get_auth_response()
|
||||
token = sp_oauth.get_access_token(code, as_dict=False)
|
||||
else:
|
||||
if is_token_expired():
|
||||
if sp_oauth.is_token_expired(token_info):
|
||||
token_info = refresh_access_token(token_info)
|
||||
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()
|
||||
if not token_info:
|
||||
return True
|
||||
else:
|
||||
return sp_oauth.is_token_expired(token_info)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
get_access_token()
|
||||
main()
|
||||
print('led-matrix-viewer started')
|
||||
|
||||
|
|
Loading…
Reference in a new issue