[GH-ISSUE #552] All queries return 404 "non existing id" #331

Closed
opened 2026-02-27 23:22:03 +03:00 by kerem · 8 comments
Owner

Originally created by @ciferkey on GitHub (Jul 30, 2020).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/552

Describe the bug
Authenticated using client_id and client secret.
All endpoints return either 404 "non existing id" for single item queries like artist or empty lists of results for queries like search.

Your code

import spotipy
from spotipy.oauth2 import SpotifyClientCredentials

auth_manager = SpotifyClientCredentials()

sp = spotipy.Spotify(auth_manager=auth_manager)

uri = "https://open.spotify.com/show/71mvGXupfKcmO6jlmOJQTP"

show = sp.show(uri)
print(show)

Expected behavior
Should return a result for a valid query ID.

Output

HTTP Error for GET to https://api.spotify.com/v1/shows/71mvGXupfKcmO6jlmOJQTP returned 404 due to non existing id
Traceback (most recent call last):
  File "/home/ciferkey/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/spotipy/client.py", line 175, in _internal_call
    response.raise_for_status()
  File "/home/ciferkey/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/requests/models.py", line 941, 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/71mvGXupfKcmO6jlmOJQTP

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ciferkey/PycharmProjects/pythonProject/main.py", line 14, in <module>
    show = sp.show(url)
  File "/home/ciferkey/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/spotipy/client.py", line 384, in show
    return self._get("shows/" + trid, market=market)
  File "/home/ciferkey/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/spotipy/client.py", line 210, in _get
    return self._internal_call("GET", url, payload, kwargs)
  File "/home/ciferkey/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/spotipy/client.py", line 186, in _internal_call
    raise SpotifyException(
spotipy.exceptions.SpotifyException: http status: 404, code:-1 - https://api.spotify.com/v1/shows/71mvGXupfKcmO6jlmOJQTP:
 non existing id

Environment:

  • OS: Linux, Manjaro 20
  • Python version: 3.8 Virtualenv
  • spotipy version: 2.13.0
  • IDE: PyCharm

Additional context
I've tried a variety of endpoints and they all seem to fail in the same way.

Originally created by @ciferkey on GitHub (Jul 30, 2020). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/552 **Describe the bug** Authenticated using client_id and client secret. All endpoints return either 404 "non existing id" for single item queries like artist or empty lists of results for queries like search. **Your code** ```python import spotipy from spotipy.oauth2 import SpotifyClientCredentials auth_manager = SpotifyClientCredentials() sp = spotipy.Spotify(auth_manager=auth_manager) uri = "https://open.spotify.com/show/71mvGXupfKcmO6jlmOJQTP" show = sp.show(uri) print(show) ``` **Expected behavior** Should return a result for a valid query ID. **Output** ``` HTTP Error for GET to https://api.spotify.com/v1/shows/71mvGXupfKcmO6jlmOJQTP returned 404 due to non existing id Traceback (most recent call last): File "/home/ciferkey/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/spotipy/client.py", line 175, in _internal_call response.raise_for_status() File "/home/ciferkey/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/requests/models.py", line 941, 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/71mvGXupfKcmO6jlmOJQTP During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ciferkey/PycharmProjects/pythonProject/main.py", line 14, in <module> show = sp.show(url) File "/home/ciferkey/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/spotipy/client.py", line 384, in show return self._get("shows/" + trid, market=market) File "/home/ciferkey/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/spotipy/client.py", line 210, in _get return self._internal_call("GET", url, payload, kwargs) File "/home/ciferkey/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/spotipy/client.py", line 186, in _internal_call raise SpotifyException( spotipy.exceptions.SpotifyException: http status: 404, code:-1 - https://api.spotify.com/v1/shows/71mvGXupfKcmO6jlmOJQTP: non existing id ``` **Environment:** - OS: Linux, Manjaro 20 - Python version: 3.8 Virtualenv - spotipy version: 2.13.0 - IDE: PyCharm **Additional context** I've tried a variety of endpoints and they all seem to fail in the same way.
kerem 2026-02-27 23:22:03 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@felix-hilden commented on GitHub (Aug 2, 2020):

The resource is in URL form, not URI. Could you try e.g. spotify:show:71mvGXupfKcmO6jlmOJQTP?

Although, looking at the source it seems that URLs should be accepted too.

<!-- gh-comment-id:667700705 --> @felix-hilden commented on GitHub (Aug 2, 2020): The resource is in URL form, not URI. Could you try e.g. `spotify:show:71mvGXupfKcmO6jlmOJQTP`? Although, looking at the source it seems that URLs should be accepted too.
Author
Owner

@ciferkey commented on GitHub (Aug 4, 2020):

@felix-hilden Correct docs say you can supply "show_id - the show ID, URI or URL". The specific example is a URL but I've tried all they and they behaved the same way.

<!-- gh-comment-id:668678879 --> @ciferkey commented on GitHub (Aug 4, 2020): @felix-hilden Correct docs say you can supply "show_id - the show ID, URI or URL". The specific example is a URL but I've tried all they and they behaved the same way.
Author
Owner

@ciferkey commented on GitHub (Aug 5, 2020):

The plot thickens. Seems other users are having issues with the shows endpoint: https://community.spotify.com/t5/Spotify-for-Developers/Searching-for-podcasts-not-returning-results/m-p/4973209#M429

<!-- gh-comment-id:669330043 --> @ciferkey commented on GitHub (Aug 5, 2020): The plot thickens. Seems other users are having issues with the shows endpoint: https://community.spotify.com/t5/Spotify-for-Developers/Searching-for-podcasts-not-returning-results/m-p/4973209#M429
Author
Owner

@ciferkey commented on GitHub (Aug 6, 2020):

Another update based on on the forum.

This is definitely a problem with their API not conforming with the published documentation. The market param is documented as optional but it actually required.

This will not return a result: https://api.spotify.com/v1/shows/71mvGXupfKcmO6jlmOJQTP
But this will: https://api.spotify.com/v1/shows/71mvGXupfKcmO6jlmOJQTP?market=US

If we want this library to confirm with the docs I can close this issue and leave the code as is.
Alternatively the library could be updated to make the market parameter required. I'd be willing to make a PR with this quick fix and provide documentation for why it is needed.

<!-- gh-comment-id:669984349 --> @ciferkey commented on GitHub (Aug 6, 2020): Another update based on on the forum. This is definitely a problem with their API not conforming with the published documentation. The market param is documented as optional but it actually required. This will not return a result: https://api.spotify.com/v1/shows/71mvGXupfKcmO6jlmOJQTP But this will: https://api.spotify.com/v1/shows/71mvGXupfKcmO6jlmOJQTP?market=US If we want this library to confirm with the docs I can close this issue and leave the code as is. Alternatively the library could be updated to make the market parameter required. I'd be willing to make a PR with this quick fix and provide documentation for why it is needed.
Author
Owner

@felix-hilden commented on GitHub (Aug 6, 2020):

It is needed with application tokens but not user tokens. I think the API is fine. Shows consider the market of a user or the specified market. See the doc for more info https://developer.spotify.com/documentation/web-api/reference/shows/get-a-show/

Though a notice about that to Spotipy documentation would be in order for sure.

<!-- gh-comment-id:669990755 --> @felix-hilden commented on GitHub (Aug 6, 2020): It is needed with application tokens but not user tokens. I think the API is fine. Shows consider the market of a user or the specified market. See the doc for more info https://developer.spotify.com/documentation/web-api/reference/shows/get-a-show/ Though a notice about that to Spotipy documentation would be in order for sure.
Author
Owner

@ciferkey commented on GitHub (Aug 6, 2020):

Sounds good. I'll mark as closed then!

<!-- gh-comment-id:670106562 --> @ciferkey commented on GitHub (Aug 6, 2020): Sounds good. I'll mark as closed then!
Author
Owner

@stephanebruckert commented on GitHub (Aug 6, 2020):

What was the simple answer to this in the end?

It didn't find the show because your user token is not from the US, so in your specific case you should specify it?

<!-- gh-comment-id:670175468 --> @stephanebruckert commented on GitHub (Aug 6, 2020): What was the simple answer to this in the end? It didn't find the show because your user token is not from the US, so in your specific case you should specify it?
Author
Owner

@felix-hilden commented on GitHub (Aug 6, 2020):

As the documentation suggests, either the market is inferred from a user's country, or it must be specified. Otherwise the show is treated as not available.

<!-- gh-comment-id:670188472 --> @felix-hilden commented on GitHub (Aug 6, 2020): As the documentation suggests, either the market is inferred from a user's country, or it must be specified. Otherwise the show is treated as not available.
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#331
No description provided.