spotipy-dev / spotipy

A light weight Python library for the Spotify Web API
http://spotipy.readthedocs.org
MIT License
5.03k stars 957 forks source link

transfer_playback throws 500 error #1001

Closed chatziko closed 3 months ago

chatziko commented 1 year ago

Describe the bug

For some days now, transfer_playback returns a 500 error every single time. Most likely a server issue, but I'm wondering, is it happening to anyone else?

Your code

client = spotipy.Spotify(auth_manager=spotipy.oauth2.SpotifyOAuth(
    scope=scope, client_id=client_id, client_secret=client_secret, redirect_uri=redirect_uri, cache_handler=cache_handler
), retries=0)
client.transfer_playback(device_id, False)

Output

Max Retries reached
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 836, in urlopen
    retries = retries.increment(method, url, response=response, _pool=self)
  File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 574, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.spotify.com', port=443): Max retries exceeded with url: /v1/me/player (Caused by ResponseError('too many 500 error responses'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/spotipy/client.py", line 266, in _internal_call
    response = self._session.request(
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 544, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 657, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 507, in send
    raise RetryError(e, request=request)
requests.exceptions.RetryError: HTTPSConnectionPool(host='api.spotify.com', port=443): Max retries exceeded with url: /v1/me/player (Caused by ResponseError('too many 500 error responses'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/a.py", line 31, in <module>
    client.transfer_playback(device_id, False)
  File "/usr/local/lib/python3.10/dist-packages/spotipy/client.py", line 1780, in transfer_playback
    return self._put("me/player", payload=data)
  File "/usr/local/lib/python3.10/dist-packages/spotipy/client.py", line 338, in _put
    return self._internal_call("PUT", url, payload, kwargs)
  File "/usr/local/lib/python3.10/dist-packages/spotipy/client.py", line 307, in _internal_call
    raise SpotifyException(
spotipy.exceptions.SpotifyException: http status: 429, code:-1 - /v1/me/player:
 Max Retries, reason: too many 500 error responses

Environment:

stephanebruckert commented 4 months ago

Are you still getting this?

chatziko commented 4 months ago

I haven't tried in a while, to be honest. Feel free to close this if nobody else is affected.

dieser-niko commented 4 months ago

This issue reminds me of #1093. Would be a coincidence, but do you have a lot of saved tracks?

chatziko commented 4 months ago

Just 9. Seems more like a temporary server issue to me, but I've changed my setup so it's hard to reproduce it now.

dieser-niko commented 3 months ago

I'm going to close the issue, but if you (or anyone else) gets this error again, please reopen the issue.