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

Made cache_path and username optional #567

Merged
merged 5 commits into from Aug 30, 2020
Merged

Conversation

stephanebruckert
Copy link
Member

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

Copy link
Contributor

@DJSdev DJSdev left a 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

token_info["refresh_token"]
)
except IOError:
pass
Copy link
Contributor

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?

Suggested change
pass
logger.warning("Couldn't read cache at: %s", self.cache_path)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep

Copy link

@G-S-Paris G-S-Paris Sep 8, 2020

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 :)

Copy link
Member Author

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

spotipy/oauth2.py Outdated Show resolved Hide resolved
spotipy/oauth2.py Outdated Show resolved Hide resolved
Copy link
Contributor

@DJSdev DJSdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

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.

spotipy.oauth2.SpotifyOauthError: You must either set a cache_path or a username
5 participants