mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 17:23:53 +00:00
Fixed a bug in CacheFileHandler.__init__: The documentation says that the username will be retrieved from the environment, but it wasn't.
This commit is contained in:
parent
0b6ede6876
commit
bc7343c206
@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
* Added `MemoryCacheHandler`, a cache handler that simply stores the token info in memory as an instance attribute of this class.
|
* Added `MemoryCacheHandler`, a cache handler that simply stores the token info in memory as an instance attribute of this class.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* Fixed a bug in `CacheFileHandler.__init__`: The documentation says that the username will be retrieved from the environment, but it wasn't.
|
||||||
|
|
||||||
## [2.18.0] - 2021-04-13
|
## [2.18.0] - 2021-04-13
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@ -3,6 +3,8 @@ __all__ = ['CacheHandler', 'CacheFileHandler', 'MemoryCacheHandler']
|
|||||||
import errno
|
import errno
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
from spotipy.util import CLIENT_CREDS_ENV_VARS
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -53,6 +55,7 @@ class CacheFileHandler(CacheHandler):
|
|||||||
self.cache_path = cache_path
|
self.cache_path = cache_path
|
||||||
else:
|
else:
|
||||||
cache_path = ".cache"
|
cache_path = ".cache"
|
||||||
|
username = (username or os.getenv(CLIENT_CREDS_ENV_VARS["client_username"]))
|
||||||
if username:
|
if username:
|
||||||
cache_path += "-" + str(username)
|
cache_path += "-" + str(username)
|
||||||
self.cache_path = cache_path
|
self.cache_path = cache_path
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user