[GH-ISSUE #1024] Max retries reached when trying to get saved songs. #608

Closed
opened 2026-02-28 00:00:14 +03:00 by kerem · 1 comment
Owner

Originally created by @Junglejon on GitHub (Aug 29, 2023).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1024

Describe the bug
If I call spotipy.current_user_saved_tracks() against my current library, I get a get 'Max reries reached' error.
I have nearly 26k files in my library, but the content should be paged but I don't seem to even be able to get past the first page.

Your code

saved_tracks_response = self.sp.current_user_saved_tracks()

My scope is set to 'user-library-read'.

Expected behavior
Should get a pageable response to iterate through like songs.

Output
http status: 429, code:-1 - /v1/me/tracks?offset=20&limit=20:
Max Retries, reason: too many 500 error responses
File "D:\git\Junglescripts\Python.venv\Lib\site-packages\requests\adapters.py", line 486, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File "D:\git\Junglescripts\Python.venv\Lib\site-packages\urllib3\connectionpool.py", line 941, in urlopen
return self.urlopen(
^^^^^^^^^^^^^
File "D:\git\Junglescripts\Python.venv\Lib\site-packages\urllib3\connectionpool.py", line 941, in urlopen
return self.urlopen(
^^^^^^^^^^^^^
File "D:\git\Junglescripts\Python.venv\Lib\site-packages\urllib3\connectionpool.py", line 941, in urlopen
return self.urlopen(
^^^^^^^^^^^^^
File "D:\git\Junglescripts\Python.venv\Lib\site-packages\urllib3\connectionpool.py", line 931, in urlopen
retries = retries.increment(method, url, response=response, _pool=self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\git\Junglescripts\Python.venv\Lib\site-packages\urllib3\util\retry.py", line 515, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.spotify.com', port=443): Max retries exceeded with url: /v1/me/tracks?offset=20&limit=20 (Caused by ResponseError('too many 500 error responses'))

If I step through, I can get a page of results, so perhaps I need to change the timeout?

Environment:

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

Additional context
If I step through the

Originally created by @Junglejon on GitHub (Aug 29, 2023). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1024 **Describe the bug** If I call spotipy.current_user_saved_tracks() against my current library, I get a get 'Max reries reached' error. I have nearly 26k files in my library, but the content should be paged but I don't seem to even be able to get past the first page. **Your code** saved_tracks_response = self.sp.current_user_saved_tracks() My scope is set to 'user-library-read'. **Expected behavior** Should get a pageable response to iterate through like songs. **Output** http status: 429, code:-1 - /v1/me/tracks?offset=20&limit=20: Max Retries, reason: too many 500 error responses File "D:\git\Junglescripts\Python\.venv\Lib\site-packages\requests\adapters.py", line 486, in send resp = conn.urlopen( ^^^^^^^^^^^^^ File "D:\git\Junglescripts\Python\.venv\Lib\site-packages\urllib3\connectionpool.py", line 941, in urlopen return self.urlopen( ^^^^^^^^^^^^^ File "D:\git\Junglescripts\Python\.venv\Lib\site-packages\urllib3\connectionpool.py", line 941, in urlopen return self.urlopen( ^^^^^^^^^^^^^ File "D:\git\Junglescripts\Python\.venv\Lib\site-packages\urllib3\connectionpool.py", line 941, in urlopen return self.urlopen( ^^^^^^^^^^^^^ File "D:\git\Junglescripts\Python\.venv\Lib\site-packages\urllib3\connectionpool.py", line 931, in urlopen retries = retries.increment(method, url, response=response, _pool=self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\git\Junglescripts\Python\.venv\Lib\site-packages\urllib3\util\retry.py", line 515, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.spotify.com', port=443): Max retries exceeded with url: /v1/me/tracks?offset=20&limit=20 (Caused by ResponseError('too many 500 error responses')) If I step through, I can get a page of results, so perhaps I need to change the timeout? **Environment:** - OS: [Windows] - Python version [e.g. 3.11.0] - your IDE (if using any) [e.g. VSCode] **Additional context** If I step through the
kerem 2026-02-28 00:00:14 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@dieser-niko commented on GitHub (May 21, 2024):

Closing as there's a duplicate (#1093). Your issue was here first, but the one mentioned is a bit more tidy. I hope you don't mind.

<!-- gh-comment-id:2123454299 --> @dieser-niko commented on GitHub (May 21, 2024): Closing as there's a duplicate (#1093). Your issue was here first, but the one mentioned is a bit more tidy. I hope you don't mind.
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#608
No description provided.