From 1a2aedf7a54269557f6e5aa8edeeb2411762292d Mon Sep 17 00:00:00 2001 From: Tim Rae Date: Mon, 20 May 2024 19:36:07 +0200 Subject: [PATCH] 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 --- src/spotify_to_tidal/auth.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/spotify_to_tidal/auth.py b/src/spotify_to_tidal/auth.py index 2bc2bba..38e22fe 100644 --- a/src/spotify_to_tidal/auth.py +++ b/src/spotify_to_tidal/auth.py @@ -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: