Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too many 429 error responses #2139

Closed
Salacfrantisek opened this issue Jul 15, 2024 · 10 comments
Closed

Too many 429 error responses #2139

Salacfrantisek opened this issue Jul 15, 2024 · 10 comments
Labels
Bug Unexpected problem or unintended behavior that needs to be fixed

Comments

@Salacfrantisek
Copy link

System OS

Linux

Python Version

3.7 (CPython)

Install Source

pip / PyPi

Install version / commit hash

v4.2.5

Expected Behavior vs Actual Behavior

For certain playlists I keep getting his error for a few weeks now

Steps to reproduce - Ensure to include actual links!

spotdl download https://open.spotify.com/playlist/4aPFTS9xyFzVukzdMPcJpv?si=6b0825556af9478f

Traceback

Max Retries reached

An error occurred                                                               
ResponseError: too many 429 error responses                                     
                                                                                
The above exception was the direct cause of the following exception:            
                                                                                
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /usr/lib/python3/dist-packages/requests/adapters.py:486 in send              │
│                                                                              │
│   483 │   │   │   timeout = TimeoutSauce(connect=timeout, read=timeout)      │
│   484 │   │                                                                  │
│   485 │   │   try:                                                           │
│ ❱ 486 │   │   │   resp = conn.urlopen(                                       │
│   487 │   │   │   │   method=request.method,                                 │
│   488 │   │   │   │   url=url,                                               │
│   489 │   │   │   │   body=request.body,                                     │
│                                                                              │
│ /home/fanda/.local/lib/python3.11/site-packages/urllib3/connectionpool.py:94 │
│ 8 in urlopen                                                                 │
│                                                                              │
│    945 │   │   │   response.drain_conn()                                     │
│    946 │   │   │   retries.sleep(response)                                   │
│    947 │   │   │   log.debug("Retry: %s", url)                               │
│ ❱  948 │   │   │   return self.urlopen(                                      │
│    949 │   │   │   │   method,                                               │
│    950 │   │   │   │   url,                                                  │
│    951 │   │   │   │   body,                                                 │
│                                                                              │
│ /home/fanda/.local/lib/python3.11/site-packages/urllib3/connectionpool.py:94 │
│ 8 in urlopen                                                                 │
│                                                                              │
│    945 │   │   │   response.drain_conn()                                     │
│    946 │   │   │   retries.sleep(response)                                   │
│    947 │   │   │   log.debug("Retry: %s", url)                               │
│ ❱  948 │   │   │   return self.urlopen(                                      │
│    949 │   │   │   │   method,                                               │
│    950 │   │   │   │   url,                                                  │
│    951 │   │   │   │   body,                                                 │
│                                                                              │
│ /home/fanda/.local/lib/python3.11/site-packages/urllib3/connectionpool.py:94 │
│ 8 in urlopen                                                                 │
│                                                                              │
│    945 │   │   │   response.drain_conn()                                     │
│    946 │   │   │   retries.sleep(response)                                   │
│    947 │   │   │   log.debug("Retry: %s", url)                               │
│ ❱  948 │   │   │   return self.urlopen(                                      │
│    949 │   │   │   │   method,                                               │
│    950 │   │   │   │   url,                                                  │
│    951 │   │   │   │   body,                                                 │
│                                                                              │
│ /home/fanda/.local/lib/python3.11/site-packages/urllib3/connectionpool.py:93 │
│ 8 in urlopen                                                                 │
│                                                                              │
│    935 │   │   has_retry_after = bool(response.headers.get("Retry-After"))   │
│    936 │   │   if retries.is_retry(method, response.status, has_retry_after) │
│    937 │   │   │   try:                                                      │
│ ❱  938 │   │   │   │   retries = retries.increment(method, url, response=res │
│    939 │   │   │   except MaxRetryError:                                     │
│    940 │   │   │   │   if retries.raise_on_status:                           │
│    941 │   │   │   │   │   response.drain_conn()                             │
│                                                                              │
│ /home/fanda/.local/lib/python3.11/site-packages/urllib3/util/retry.py:515 in │
│ increment                                                                    │
│                                                                              │
│   512 │   │                                                                  │
│   513 │   │   if new_retry.is_exhausted():                                   │
│   514 │   │   │   reason = error or ResponseError(cause)                     │
│ ❱ 515 │   │   │   raise MaxRetryError(_pool, url, reason) from reason  # typ │
│       ignore[arg-type]                                                       │
│   516 │   │                                                                  │
│   517 │   │   log.debug("Incremented Retry for (url='%s'): %r", url, new_ret │
│   518                                                                        │
╰──────────────────────────────────────────────────────────────────────────────╯
MaxRetryError: HTTPSConnectionPool(host='api.spotify.com', port=443): Max       
retries exceeded with url:                                                      
/v1/playlists/4aPFTS9xyFzVukzdMPcJpv?additional_types=track (Caused by          
ResponseError('too many 429 error responses'))                                  
                                                                                
During handling of the above exception, another exception occurred:             
                                                                                
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /home/fanda/.local/lib/python3.11/site-packages/spotipy/client.py:266 in     │
│ _internal_call                                                               │
│                                                                              │
│    263 │   │   │   │   │    method, url, args.get("params"), headers, args.g │
│    264 │   │                                                                 │
│    265 │   │   try:                                                          │
│ ❱  266 │   │   │   response = self._session.request(                         │
│    267 │   │   │   │   method, url, headers=headers, proxies=self.proxies,   │
│    268 │   │   │   │   timeout=self.requests_timeout, **args                 │
│    269 │   │   │   )                                                         │
│                                                                              │
│ /usr/lib/python3/dist-packages/requests/sessions.py:589 in request           │
│                                                                              │
│   586 │   │   │   "allow_redirects": allow_redirects,                        │
│   587 │   │   }                                                              │
│   588 │   │   send_kwargs.update(settings)                                   │
│ ❱ 589 │   │   resp = self.send(prep, **send_kwargs)                          │
│   590 │   │                                                                  │
│   591 │   │   return resp                                                    │
│   592                                                                        │
│                                                                              │
│ /usr/lib/python3/dist-packages/requests/sessions.py:703 in send              │
│                                                                              │
│   700 │   │   start = preferred_clock()                                      │
│   701 │   │                                                                  │
│   702 │   │   # Send the request                                             │
│ ❱ 703 │   │   r = adapter.send(request, **kwargs)                            │
│   704 │   │                                                                  │
│   705 │   │   # Total elapsed time of the request (approximately)            │
│   706 │   │   elapsed = preferred_clock() - start                            │
│                                                                              │
│ /usr/lib/python3/dist-packages/requests/adapters.py:510 in send              │
│                                                                              │
│   507 │   │   │   │   │   raise ConnectTimeout(e, request=request)           │
│   508 │   │   │                                                              │
│   509 │   │   │   if isinstance(e.reason, ResponseError):                    │
│ ❱ 510 │   │   │   │   raise RetryError(e, request=request)                   │
│   511 │   │   │                                                              │
│   512 │   │   │   if isinstance(e.reason, _ProxyError):                      │
│   513 │   │   │   │   raise ProxyError(e, request=request)                   │
╰──────────────────────────────────────────────────────────────────────────────╯
RetryError: HTTPSConnectionPool(host='api.spotify.com', port=443): Max retries  
exceeded with url: /v1/playlists/4aPFTS9xyFzVukzdMPcJpv?additional_types=track  
(Caused by ResponseError('too many 429 error responses'))                       
                                                                                
During handling of the above exception, another exception occurred:             
                                                                                
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /home/fanda/.local/lib/python3.11/site-packages/spotdl/console/entry_point.p │
│ y:142 in console_entry_point                                                 │
│                                                                              │
│   139 │   try:                                                               │
│   140 │   │   # Pick the operation to perform                                │
│   141 │   │   # based on the name and run it!                                │
│ ❱ 142 │   │   OPERATIONS[arguments.operation](                               │
│   143 │   │   │   query=arguments.query,                                     │
│   144 │   │   │   downloader=downloader,                                     │
│   145 │   │   )                                                              │
│                                                                              │
│ /home/fanda/.local/lib/python3.11/site-packages/spotdl/console/download.py:2 │
│ 5 in download                                                                │
│                                                                              │
│   22 │   """                                                                 │
│   23 │                                                                       │
│   24 │   # Parse the query                                                   │
│ ❱ 25 │   songs = get_simple_songs(                                           │
│   26 │   │   query,                                                          │
│   27 │   │   use_ytm_data=downloader.settings["ytm_data"],                   │
│   28 │   │   playlist_numbering=downloader.settings["playlist_numbering"],   │
│                                                                              │
│ /home/fanda/.local/lib/python3.11/site-packages/spotdl/utils/search.py:260   │
│ in get_simple_songs                                                          │
│                                                                              │
│   257 │   │   │   )                                                          │
│   258 │   │   │   songs.extend(full_lists)                                   │
│   259 │   │   elif "open.spotify.com" in request and "playlist" in request:  │
│ ❱ 260 │   │   │   lists.append(Playlist.from_url(request, fetch_songs=False) │
│   261 │   │   elif "open.spotify.com" in request and "album" in request:     │
│   262 │   │   │   lists.append(Album.from_url(request, fetch_songs=False))   │
│   263 │   │   elif "open.spotify.com" in request and "artist" in request:    │
│                                                                              │
│ /home/fanda/.local/lib/python3.11/site-packages/spotdl/types/song.py:306 in  │
│ from_url                                                                     │
│                                                                              │
│   303 │   │   - The SongList object.                                         │
│   304 │   │   """                                                            │
│   305 │   │                                                                  │
│ ❱ 306 │   │   metadata, songs = cls.get_metadata(url)                        │
│   307 │   │   urls = [song.url for song in songs]                            │
│   308 │   │                                                                  │
│   309 │   │   if fetch_songs:                                                │
│                                                                              │
│ /home/fanda/.local/lib/python3.11/site-packages/spotdl/types/playlist.py:48  │
│ in get_metadata                                                              │
│                                                                              │
│    45 │   │                                                                  │
│    46 │   │   spotify_client = SpotifyClient()                               │
│    47 │   │                                                                  │
│ ❱  48 │   │   playlist = spotify_client.playlist(url)                        │
│    49 │   │   if playlist is None:                                           │
│    50 │   │   │   raise PlaylistError("Invalid playlist URL.")               │
│    51                                                                        │
│                                                                              │
│ /home/fanda/.local/lib/python3.11/site-packages/spotipy/client.py:651 in     │
│ playlist                                                                     │
│                                                                              │
│    648 │   │   │   │   │   │   │   │   │    valid types are: track and episo │
│    649 │   │   """                                                           │
│    650 │   │   plid = self._get_id("playlist", playlist_id)                  │
│ ❱  651 │   │   return self._get(                                             │
│    652 │   │   │   "playlists/%s" % (plid),                                  │
│    653 │   │   │   fields=fields,                                            │
│    654 │   │   │   market=market,                                            │
│                                                                              │
│ /home/fanda/.local/lib/python3.11/site-packages/spotdl/utils/spotify.py:195  │
│ in _get                                                                      │
│                                                                              │
│   192 │   │   retries = self.max_retries  # type: ignore # pylint: disable=E │
│   193 │   │   while response is None:                                        │
│   194 │   │   │   try:                                                       │
│ ❱ 195 │   │   │   │   response = self._internal_call("GET", url, payload, kw │
│   196 │   │   │   except (requests.exceptions.Timeout, requests.ConnectionEr │
│   197 │   │   │   │   retries -= 1                                           │
│   198 │   │   │   │   if retries <= 0:                                       │
│                                                                              │
│ /home/fanda/.local/lib/python3.11/site-packages/spotipy/client.py:307 in     │
│ _internal_call                                                               │
│                                                                              │
│    304 │   │   │   │   reason = retry_error.args[0].reason                   │
│    305 │   │   │   except (IndexError, AttributeError):                      │
│    306 │   │   │   │   reason = None                                         │
│ ❱  307 │   │   │   raise SpotifyException(                                   │
│    308 │   │   │   │   429,                                                  │
│    309 │   │   │   │   -1,                                                   │
│    310 │   │   │   │   "%s:\n %s" % (request.path_url, "Max Retries"),       │
╰──────────────────────────────────────────────────────────────────────────────╯
SpotifyException: http status: 429, code:-1 -                                   
/v1/playlists/4aPFTS9xyFzVukzdMPcJpv?additional_types=track:                    
 Max Retries, reason: too many 429 error responses

Other details

No response

@Salacfrantisek Salacfrantisek added the Bug Unexpected problem or unintended behavior that needs to be fixed label Jul 15, 2024
@Loudic85
Copy link

I have also this error actually and i have sent a message in a solved issue... Let's see if someone will reply me...

@OcelotWalrus
Copy link

I've got this too :|

@OcelotWalrus
Copy link

So we need to set a delay between retries?

@joaquinito2070
Copy link

We are on vacation. In september, we will be back, and we will fix these issues. :)

@OcelotWalrus
Copy link

Thanks!

@sanderjo
Copy link

Me too.

Downgrading helped.

python3 -m pip index versions spotdl
python3 -m pip install spotdl==4.2.4

@OcelotWalrus
Copy link

Me too.

Downgrading helped.

python3 -m pip index versions spotdl
python3 -m pip install spotdl==4.2.4

Doesn't work for me. I still get that same error.

@xnetcat
Copy link
Member

xnetcat commented Jul 21, 2024

#2142

@xnetcat
Copy link
Member

xnetcat commented Jul 21, 2024

closing in favor of #2142

@xnetcat xnetcat closed this as not planned Won't fix, can't repro, duplicate, stale Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Unexpected problem or unintended behavior that needs to be fixed
Projects
None yet
Development

No branches or pull requests

7 participants