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 cache_path as an argument to prompt_for_user_token() #169

Merged
merged 1 commit into from Sep 17, 2017

Conversation

@jessejoe
Copy link
Contributor

@jessejoe jessejoe commented Mar 8, 2017

Fixes #167

This allows overriding the default relative location of cache_path when calling prompt_for_user_token(). External scripts will be able to avoid creating a .cache-username file in whatever directory the user happens to be in when the script is ran.

I personally think cache_path should default to os.path.join(os.path.expanduser('~'), '.cache-' + username) so cache_path always references the same file in the user's $HOME, but that would probably break a lot of existing users.

@KevinMGranger
Copy link
Contributor

@KevinMGranger KevinMGranger commented Mar 10, 2017

Ideally, the cache path would be in the $XDG_CACHE_DIR, which defaults to ~/.cache/, so something like ~/.cache/spotipy-$USERNAME

@jessejoe
Copy link
Contributor Author

@jessejoe jessejoe commented Mar 11, 2017

@KevinMGranger I don't think that's cross-patform (i.e. Windows). Could always adopt the pip method though: https://github.com/dstufft/pip/blob/master/docs/user_guide.rst#config-file

pip is just using appdirs from https://github.com/ActiveState/appdirs, see https://github.com/dstufft/pip/blob/master/pip/utils/appdirs.py#L2

@eriktaubeneck
Copy link

@eriktaubeneck eriktaubeneck commented May 25, 2017

It would be great to merge this, and open a new issue to discuss/decide on a sane default. This PR doesn't introduce breaking changes and adds flexibility (and unblocks a blocker for me.)

@plamere
Copy link
Owner

@plamere plamere commented Sep 17, 2017

sorry for the 6 month delay, finally getting to look at my spotipy backlog. Looks like a good PR, thanks!

@plamere plamere merged commit a99d204 into plamere:master Sep 17, 2017
@jessejoe jessejoe deleted the jessejoe:add_cache_path_param branch Nov 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.