spotipy-dev / spotipy

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

Podcast Playlist retrieval not working #912

Open deadl0ck opened 1 year ago

deadl0ck commented 1 year ago

Describe the bug Trying to call the "show_episodes" api in spotipy and getting back "returned 404 due to non existing id"

Your code SHOW_ID = "00sL9tgDezr0PRSzd3C7H6" spotify = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials()) results = spotify.show_episodes(f'{SHOW_ID}')

Expected behavior Should return shows as JSON

Output /Users/mstephenson/opt/miniconda3/envs/RAMagGenPy/bin/python /Users/mstephenson/git/RGDSMag/venv/spotify.py HTTP Error for GET to https://api.spotify.com/v1/shows/00sL9tgDezr0PRSzd3C7H6/episodes/ with Params: {'limit': 50, 'offset': 0, 'market': None} returned 404 due to non existing id Traceback (most recent call last): File "/Users/mstephenson/opt/miniconda3/envs/RAMagGenPy/lib/python3.9/site-packages/spotipy/client.py", line 245, in _internal_call response.raise_for_status() File "/Users/mstephenson/opt/miniconda3/envs/RAMagGenPy/lib/python3.9/site-packages/requests/models.py", line 953, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.spotify.com/v1/shows/00sL9tgDezr0PRSzd3C7H6/episodes/?limit=50&offset=0

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/mstephenson/git/RGDSMag/venv/spotify.py", line 9, in results = spotify.show_episodes(f'{SHOW_ID}') File "/Users/mstephenson/opt/miniconda3/envs/RAMagGenPy/lib/python3.9/site-packages/spotipy/client.py", line 512, in show_episodes return self._get( File "/Users/mstephenson/opt/miniconda3/envs/RAMagGenPy/lib/python3.9/site-packages/spotipy/client.py", line 297, in _get return self._internal_call("GET", url, payload, kwargs) File "/Users/mstephenson/opt/miniconda3/envs/RAMagGenPy/lib/python3.9/site-packages/spotipy/client.py", line 267, in _internal_call raise SpotifyException( spotipy.exceptions.SpotifyException: http status: 404, code:-1 - https://api.spotify.com/v1/shows/00sL9tgDezr0PRSzd3C7H6/episodes/?limit=50&offset=0: non existing id, reason: None

Environment:

Additional context I believe the scope is not being used. I can get the show ID using curl and the example here: https://developer.spotify.com/console/get-show-episodes/?id=00sL9tgDezr0PRSzd3C7H6&market=&limit=50&offset=0

I can recreate the error in Curl if I use the Bearer ID from the spotipy client, so I believe there is an error with the Berer ID in that it needs to be in the correct scope (user-read-playback-position) - see https://developer.spotify.com/documentation/general/guides/authorization/scopes/

dieser-niko commented 1 year ago

https://github.com/spotipy-dev/spotipy/issues/925#issuecomment-1369777663