Set 2s timeout when connecting to Spotify
I've been having an issue where the script hangs for a long time when starting up. It seems to be caused by the connection request to Spotify failing on the first request (which uses IPv6) and having to wait for the retry attempt using IPv4 2s should be plenty for just getting the refresh token and is much more tolerable in case of IPv6 failure
This commit is contained in:
@@ -16,7 +16,8 @@ def open_spotify_session(config) -> spotipy.Spotify:
|
||||
scope='playlist-read-private',
|
||||
client_id=config['client_id'],
|
||||
client_secret=config['client_secret'],
|
||||
redirect_uri=config['redirect_uri'])
|
||||
redirect_uri=config['redirect_uri'],
|
||||
requests_timeout=2)
|
||||
try:
|
||||
credentials_manager.get_access_token(as_dict=False)
|
||||
except spotipy.SpotifyOauthError:
|
||||
|
||||
Reference in New Issue
Block a user