Skip to content

Commit

Permalink
Fix configuration error when connecting to Spotify for the first time
Browse files Browse the repository at this point in the history
When there was no .cache file, it had to ask Spotify for the tokens. However, since the token_info was None, it tried accessing something that never existed in the first place and failed with "Configuration error: Test connection to Spotify API failed: 'NoneType' object is not subscriptable"
  • Loading branch information
mtsanovv committed Aug 22, 2022
1 parent 661d6a7 commit 64ba137
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/youspotube/api/spotify.py
Expand Up @@ -19,7 +19,7 @@ def connection(self):
# _init_connection should have been called in order to be able to use this property
auth_manager = self.spotify.auth_manager
token_info = auth_manager.cache_handler.get_cached_token()
if auth_manager.is_token_expired(token_info):
if token_info is not None and auth_manager.is_token_expired(token_info):
self._init_connection()
return self.spotify

Expand Down

0 comments on commit 64ba137

Please sign in to comment.