rckclmbr / pyportify

App to transfer your spotify playlists to Google Play Music
Apache License 2.0
779 stars 58 forks source link

Exception: 502 Bad gateway #69

Closed brunofin closed 7 years ago

brunofin commented 8 years ago

I'm trying to transfer my playlists from Spotify to Google Play Music. Tried this today (27/06) with the latest version from pip on Fedora 23.

I've used this program before and it worked perfectly, fast and flawlessly, but now, on step 4 when it should transfer the selected playlists to PLay Music, the webpage hangs and the following error keeps being thrown in the Python console:

Error handling request
Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/aiohttp/server.py", line 266, in start
    yield from self.handle_request(message, payload)
  File "/usr/lib/python3.4/site-packages/aiohttp/web.py", line 90, in handle_request
    resp = yield from handler(request)
  File "/usr/lib/python3.4/site-packages/pyportify/app.py", line 108, in transfer_start
    yield from transfer_playlists(request, session, s, g, lists)
  File "/usr/lib/python3.4/site-packages/pyportify/app.py", line 131, in transfer_playlists
    sp_playlist_tracks = yield from s.fetch_playlist_tracks(d_list["uri"])
  File "/usr/lib/python3.4/site-packages/pyportify/spotify.py", line 76, in fetch_playlist_tracks
    ret = yield from self.fetch_saved_tracks()
  File "/usr/lib/python3.4/site-packages/pyportify/spotify.py", line 70, in fetch_saved_tracks
    tracks = yield from self._http_get_all(url)
  File "/usr/lib/python3.4/site-packages/pyportify/spotify.py", line 60, in _http_get_all
    data = yield from self._http_get(url)
  File "/usr/lib/python3.4/site-packages/pyportify/spotify.py", line 122, in _http_get
    raise Exception("Error: {0}, url: {1}".format(data, url))
Exception: Error: {'error': {'status': 502, 'message': 'Bad gateway.'}}, url: https://api.spotify.com/v1/me/tracks?offset=780&limit=20
brunofin commented 8 years ago

Ah nevermind, after trying 3 more times, it finally worked. Maybe the Spotify servers were down? Unlucky me.

I'll leave the issue open though, so you can decide whether you want to handle this error or not.

svict4 commented 8 years ago

I got this issue as well and also on the third attempt it worked fine. For anyone else getting the error, simply refresh the page, reselect the tracks you want and keep submitting till it works

rckclmbr commented 7 years ago

I added some retry logic, hopefully this fixes it.