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
Made cache_path and username optional #567
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with all the changes. Left a few comments for try/catch handling
spotipy/oauth2.py
Outdated
token_info["refresh_token"] | ||
) | ||
except IOError: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know you simply fixed up these try/catch statements. Could we throw in a logger warning similar to line 1026?
pass | |
logger.warning("Couldn't read cache at: %s", self.cache_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up doing something similar locally as a workaround, I like your fix :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I just released it in 2.15.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
As suggested here #533 (comment)
The API itself does not require a username but Spotipy was still asking for it in order to know where to store the token.
I think most devs want to get started quickly and will by default only use their main account, so storing that main account token in a cache called
.cache
should be fine.Apps that specify a username should still work.
Fixes #507, #512, #549