-
Notifications
You must be signed in to change notification settings - Fork 959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Print warnings when a rate/request limit is reached #1134
Conversation
After going a frame up, I found that It might actually be important that we don't check for the I feel that it can still fail, but the worst case would be a double entry in the logs, which would require a very niche setting for that to happen. |
…r value in the warning as well
If anyone wants to try this for themselves, just install
I use this snippet to get a persistent rate limit after a few seconds: import time
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials
import threading
sp = spotipy.Spotify(auth_manager=SpotifyClientCredentials(client_id="SPOTIPY_CLIENT_ID",
client_secret="SPOTIPY_CLIENT_SECRET"))
def do():
sp.album_tracks("2Kh43m04B1UkVcpcRa1Zug")
while True:
print(time.time())
threading.Thread(target=do, daemon=True).start()
time.sleep(0.01) If you wait long enough, you'll probably get a request limit too, but nothing will change except the wait time. |
I'm writing this sentence a fifth time. Does what the title says.
This is still a draft because I'm researching how to implement this so we can get the retry-after value right away.
Currently it only prints a warning (whose text could be improved as well)