Skip to content
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

Add --limit, --timeout, and use SpotifyOAuth #25

Merged
merged 6 commits into from
Oct 11, 2022

Conversation

joshuamegnauth54
Copy link
Contributor

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 use SpotifyOAuth instead of prompt_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.

joshuamegnauth54 and others added 6 commits September 25, 2022 19:08
I implemented a `format_album` function to deduplicate the code used to
print albums.
- Implement --limit to allow the user to specify how many new releases
  to pull. Prior to this the script always defaulted to 20.
- Clean up argument handling so that creating the parser and parsing the
  arguments are handled in one routine.
`prompt_for_token` is deprecated, so I switched to using `SpotifyOAuth`
instead.

With that said, the new code still uses a deprecated parameter,
`username`, for backwards compatibility.

I also updated the lock file.
@riverscuomo riverscuomo merged commit 68e2d05 into riverscuomo:main Oct 11, 2022
@riverscuomo
Copy link
Owner

Yes. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants