Add --limit, --timeout, and use SpotifyOAuth #25
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I updated the documentation and logging for greater clarity. I also implemented two small features.
--limit
--limit
allows the user to tune how many new releases are pulled. The argument defaults to 20 (this was your default).--timeout
Spotipy defaults to not having a timeout on requests sent to Spotify's server. However, setting a timeout is generally recommended because scripts (or whatever) will hang waiting for a response. I set the default to 20 seconds, which is plenty of time. The
--timeout
argument allows manually setting whatever timeout the user wishes.Why do we want a timeout on a server?
What is a connection timeout during a http request
SpotifyOAuth
I updated
get_spotify()
to useSpotifyOAuth
instead ofprompt_for_user_token
. The latter has been deprecated, and the new class works similarly anyway.You shouldn't notice any changes from any of the above. But! I think you may need to further update
get_spotify
to not use usernames. Apparently Spotipy now manages all of that on its own which is better than storing the.cache
file wherever the script is run.