mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-26 16:15:51 +03:00
[GH-ISSUE #805] 500 error code in sp.audio_features() reported as 429 #501
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#501
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jkulak on GitHub (May 5, 2022).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/805
Describe the bug
500error code insp.audio_features()reported as429Your code
For this particular ID, https://developer.spotify.com/console/get-audio-features-several-tracks/ returns 500.
Spotipy returns:
Expected behavior
I would expect Spotipy to show me that it is a
500error code. So I could debug and verify which ID is causing the issue on Spotify's side. When I am getting429I am assuming it is a limit error.Environment:
Additional context
The request exception is caught here:
github.com/plamere/spotipy@9a627e88f4/spotipy/client.py (L274)And then it is raising
429here:github.com/plamere/spotipy@9a627e88f4/spotipy/client.py (L281)@jkulak commented on GitHub (May 5, 2022):
Btw. those ids also return
500from Spotify's API for audio_features.2QIWo90LTeI3MXDCzgwXMb3Db20yiHMSUFP60rqFMny511mVBkAjzJy70VamIgsEOL(It is an ASMR album with ultrasonic sounds)
@Peter-Schorn commented on GitHub (May 6, 2022):
What makes you so sure that
429is the wrong error? How do you know that your requests aren't getting rate-limited by Spotify?Have you used the debugger to determine that spotipy returns a rate-limited error even when the raw network response from the requests module contains a
500status code?@jkulak commented on GitHub (May 6, 2022):
Hey. I checked what error code is returned when requesting same url using same token using Spotify’s console and then also using Postman. It returns 500 in both cases.
Spotipy returns 429 (same token, same url, before and after I tested in console).
It’s super easy to check using code samples and IDs I provided.
@dasbts commented on GitHub (May 6, 2022):
I got the same issue and error (max retries) when feeding a list of songs, and when searching for it (by link in browser and the URI ofc.) it said it was unavailable, however it was not a local song and I got the song info for it when requesting a playlist of songs. My thought is it might just not be available in your market.
My solution after trying multiple fixes is to just if you want to also fetch other songs, do a try except, and just ignore the one that doesn't work.
It's not rate limiting, at least not in my case, because all songs except some few ones don't work, and the try except allows me to fetch multiple other songs and just skip these that are retrying.
@Peter-Schorn commented on GitHub (May 6, 2022):
I was unable to reproduce the rate-limited error with any of the ids although I did get a 500 error with all of these ids. I don't know why this error is returned for certain tracks, but it's clear that this is not due to an issue on spotipy's end because I get the same error when I make the request in Postman. You'll have to ask about this on the Spotify Developer Forums.
Rate limiting is applied on a per-developer application basis, not a per-access token basis, so try creating a new developer application (which means you'll get a new client id and client secret) and then use this application with spotipy only for a single request. Can you still reproduce the rate-limited error?
@jkulak commented on GitHub (May 6, 2022):
Thank you for your answers, I appreciate your time.
Yes. But I don't mind 500s from Spotify for some IDs - it happens, it is ok. But I would like Spotipy to show me it was a 500 on Spotify's end and not 429.
This code (assuming you have your env
SPOTIPY_CLIENT_IDandSPOTIPY_CLIENT_SECRET)Results in
urllib3exception, caught and passed byrequestsexception and then caught by Spotipy and then reported asspotipy.exceptions.SpotifyException: http status: 429. Which (in my opinion) is not correct, becase my rate limits are OK, and Spotify returns500for this particular request (albo same market etc.). Full Traceback (Pastebin for convenience, line 42, https://pastebin.com/1SHAQJbH):Btw. I am working with several applications and CLIENT_IDs, I am sure I am not hitting rate limits (triple checked).
@jkulak commented on GitHub (Aug 4, 2022):
@Peter-Schorn where you able to reproduce it? I am willing to help.
@neilmenon commented on GitHub (Sep 15, 2023):
Hello @Peter-Schorn,
I've just had the same thing happen to me and see it reported here as well: https://github.com/home-assistant/core/issues/88547
gives
This was definitely not a rate-limit because it was the first call in several hours. Any ideas why it's being reported as 429?
Thanks!