[GH-ISSUE #398] Spotipy freezes on large requests using next #232

Closed
opened 2026-02-27 23:21:32 +03:00 by kerem · 3 comments
Owner

Originally created by @shillshocked on GitHub (Oct 17, 2019).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/398

After several minutes it will eventually freeze. No errors, just no further progress in retrieving a list of artists' albums. Anyway to bypass this?

I've tried retry libraries but still the same result.

Originally created by @shillshocked on GitHub (Oct 17, 2019). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/398 After several minutes it will eventually freeze. No errors, just no further progress in retrieving a list of artists' albums. Anyway to bypass this? I've tried retry libraries but still the same result.
kerem closed this issue 2026-02-27 23:21:32 +03:00
Author
Owner

@felix-hilden commented on GitHub (Oct 23, 2019):

Could you provide any additional information, like Artist ID?

<!-- gh-comment-id:545363853 --> @felix-hilden commented on GitHub (Oct 23, 2019): Could you provide any additional information, like Artist ID?
Author
Owner

@shillshocked commented on GitHub (Oct 23, 2019):

it's not specific to any URIs, it's just the way Spotipy is handling the connection.

I'm in an area with connectivity issues, so this is more of a problem for me than perhaps others. Nonetheless, the sessions code is not robust. I find that using a retrying (tenacity) decorator is the only way to handle this smoothly. I can also disable sessions in Spotipy but it still locks up on individual requests sometimes.

If I can implement a way to reset the adaptor in Python on failed requests, that would be the fastest way to address this. Connection resets when coupled with a retrying decorator will make it get over the hump without data loss handily.

Here is a way it is done with requests:

https://www.peterbe.com/plog/best-practice-with-retries-with-requests

I just can't figure out how to apply this example to Spotipy.

<!-- gh-comment-id:545675906 --> @shillshocked commented on GitHub (Oct 23, 2019): it's not specific to any URIs, it's just the way Spotipy is handling the connection. I'm in an area with connectivity issues, so this is more of a problem for me than perhaps others. Nonetheless, the sessions code is not robust. I find that using a retrying (tenacity) decorator is the only way to handle this smoothly. I can also disable sessions in Spotipy but it still locks up on individual requests sometimes. If I can implement a way to reset the adaptor in Python on failed requests, that would be the fastest way to address this. Connection resets when coupled with a retrying decorator will make it get over the hump without data loss handily. Here is a way it is done with requests: https://www.peterbe.com/plog/best-practice-with-retries-with-requests I just can't figure out how to apply this example to Spotipy.
Author
Owner

@shillshocked commented on GitHub (Oct 23, 2019):

Ah! This seems to help:

sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager, requests_timeout=10)

<!-- gh-comment-id:545678580 --> @shillshocked commented on GitHub (Oct 23, 2019): Ah! This seems to help: sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager, requests_timeout=10)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotipy#232
No description provided.