[GH-ISSUE #1157] Running .artist() & .album_tracks() methods are stuck running & won't execute #679

Closed
opened 2026-02-28 00:00:47 +03:00 by kerem · 3 comments
Owner

Originally created by @danisuba10 on GitHub (Aug 22, 2024).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1157

Describe the bug
After reaching said functions, going a line under with debugger shows nothing, like being stuck in an infinite cycle elsewhere. Going inside, goes into the library's functions, so it gets stuck somewhere there, not in my code.

This happens randomly. Sometimes it works, sometimes not. For some time it works flawlessly, and another time it gets stuck indefinitely. I tried switching Spotify accounts to check if it is a rate limit, but things did not change.

Your code
https://github.com/danisuba10/APIDataGenerator/blob/main/Sources/Generator/AlbumGenerator/AlbumMetadataGenerator.py

artist_details = self.sp.artist(artist['id'])
It gets stuck on the line above, not reaching images line
images = artist_details.get('images', [])
songs = self.sp.album_tracks(album_id)['items']
It gets stuck on the line above, not reaching song_list line
song_list = []

Expected behavior
A clear and concise description of what you expected to happen.

Output
No erros, just getting stuck indefinitely.

Environment:

  • OS: [Windows]
  • Python version [e.g. 3.12.3]
  • spotipy version [e.g. 2.24.0]
  • your IDE (if using any) [VSCode]

Additional context
Add any other context about the problem here.

Originally created by @danisuba10 on GitHub (Aug 22, 2024). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1157 **Describe the bug** After reaching said functions, going a line under with debugger shows nothing, like being stuck in an infinite cycle elsewhere. Going inside, goes into the library's functions, so it gets stuck somewhere there, not in my code. This happens randomly. Sometimes it works, sometimes not. For some time it works flawlessly, and another time it gets stuck indefinitely. I tried switching Spotify accounts to check if it is a rate limit, but things did not change. **Your code** https://github.com/danisuba10/APIDataGenerator/blob/main/Sources/Generator/AlbumGenerator/AlbumMetadataGenerator.py ``` artist_details = self.sp.artist(artist['id']) It gets stuck on the line above, not reaching images line images = artist_details.get('images', []) ``` ``` songs = self.sp.album_tracks(album_id)['items'] It gets stuck on the line above, not reaching song_list line song_list = [] ``` **Expected behavior** A clear and concise description of what you expected to happen. **Output** No erros, just getting stuck indefinitely. **Environment:** - OS: [Windows] - Python version [e.g. 3.12.3] - spotipy version [e.g. 2.24.0] - your IDE (if using any) [VSCode] **Additional context** Add any other context about the problem here.
kerem 2026-02-28 00:00:47 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@dieser-niko commented on GitHub (Aug 22, 2024):

You have probably hit a request limit. urllib will wait until the limit is gone, but with request limits this can take quite a long time.

If you want to get an error message instead, just do the following:

sp = spotipy.Spotify(
    retries=0,
    ...
)
<!-- gh-comment-id:2305194134 --> @dieser-niko commented on GitHub (Aug 22, 2024): You have probably hit a request limit. urllib will wait until the limit is gone, but with request limits this can take quite a long time. If you want to get an error message instead, just do the following: ```python3 sp = spotipy.Spotify( retries=0, ... ) ```
Author
Owner

@danisuba10 commented on GitHub (Aug 22, 2024):

Yes, checking with that option, it returns too many 429 responses. Thanks.

<!-- gh-comment-id:2305465782 --> @danisuba10 commented on GitHub (Aug 22, 2024): Yes, checking with that option, it returns too many 429 responses. Thanks.
Author
Owner

@dieser-niko commented on GitHub (Jan 3, 2025):

Hi @danisuba10, just a quick heads up, we have released a new version (2.25.0) that prints a warning when a limit is reached. I'm not sure if you're still using retries=0, but if not, this change will warn you when you reach a limit.

<!-- gh-comment-id:2569215295 --> @dieser-niko commented on GitHub (Jan 3, 2025): Hi @danisuba10, just a quick heads up, we have released a new version (2.25.0) that prints a warning when a limit is reached. I'm not sure if you're still using `retries=0`, but if not, this change will warn you when you reach a limit.
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#679
No description provided.