Bump to 2.17.0

This commit is contained in:
Stephane Bruckert 2021-02-28 10:12:26 +01:00
parent 4e1e74bddc
commit ef2ed1a9c5
5 changed files with 59 additions and 4 deletions

View File

@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased ## Unreleased
// Add your changes here and then delete this line
## [2.17.0] - 2021-02-28
### Changed ### Changed
- moved os.remove(session_cache_path()) inside try block to avoid TypeError on app.py example file - moved os.remove(session_cache_path()) inside try block to avoid TypeError on app.py example file

View File

@ -36,6 +36,28 @@ To make sure if the import lists are stored correctly:
pip install isort pip install isort
isort . -c -v isort . -c -v
### Publishing (by maintainer)
- Bump version in setup.py
- Bump and date changelog
- Add to changelog:
## Unreleased
// Add your changes here and then delete this line
- Commit changes
- Package to pypi:
python setup.py sdist bdist_wheel
python3 setup.py sdist bdist_wheel
twine check dist/*
twine upload --skip-existing dist/*.whl dist/*.gz dist/*.zip
- Create github release https://github.com/plamere/spotipy/releases with the changelog content
for the version and a short name that describes the main addition
- Verify doc uses latest https://readthedocs.org/projects/spotipy/
### Changelog ### Changelog
Don't forget to add a short description of your change in the [CHANGELOG](CHANGELOG.md) Don't forget to add a short description of your change in the [CHANGELOG](CHANGELOG.md)

View File

@ -212,6 +212,23 @@ IDs URIs and URLs
In general, any *Spotipy* method that needs an artist, album, track or playlist ID In general, any *Spotipy* method that needs an artist, album, track or playlist ID
will accept ids in any of the above form will accept ids in any of the above form
Customized token caching
========================
Tokens are refreshed automatically and stored by default in the project main folder.
As this might not suit everyone's needs, spotipy provides a way to create customized
cache handlers.
https://github.com/plamere/spotipy/blob/master/spotipy/cache_handler.py
The custom cache handler would need to be a class that inherits from the base
cache handler ``CacheHandler``. The default cache handler ``CacheFileHandler`` is a good example.
An instance of that new class can then be passed as a parameter when
creating ``SpotifyOAuth``, ``SpotifyPKCE`` or ``SpotifyImplicitGrant``.
Feel free to contribute new cache handlers to the repo.
Examples Examples
======================= =======================

View File

@ -18,7 +18,7 @@ extra_reqs = {
setup( setup(
name='spotipy', name='spotipy',
version='2.16.1', version='2.17.0',
description='A light weight Python library for the Spotify Web API', description='A light weight Python library for the Spotify Web API',
long_description=long_description, long_description=long_description,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",

View File

@ -165,9 +165,9 @@ class SpotipyPlaylistApiTest(unittest.TestCase):
self.assertEqual(playlist["total"], 0) self.assertEqual(playlist["total"], 0)
def test_playlist_cover_image(self): def test_playlist_cover_image(self):
# Upload random dog image # From https://dog.ceo/api/breeds/image/random
r = requests.get('https://dog.ceo/api/breeds/image/random') small_image = "https://images.dog.ceo/breeds/poodle-toy/n02113624_8936.jpg"
dog_base64 = helpers.get_as_base64(r.json()['message']) dog_base64 = helpers.get_as_base64(small_image)
self.spotify.playlist_upload_cover_image(self.new_playlist_uri, dog_base64) self.spotify.playlist_upload_cover_image(self.new_playlist_uri, dog_base64)
res = self.spotify.playlist_cover_image(self.new_playlist_uri) res = self.spotify.playlist_cover_image(self.new_playlist_uri)
@ -177,6 +177,18 @@ class SpotipyPlaylistApiTest(unittest.TestCase):
self.assertIn('height', first_image) self.assertIn('height', first_image)
self.assertIn('url', first_image) self.assertIn('url', first_image)
def test_large_playlist_cover_image(self):
# From https://dog.ceo/api/breeds/image/random
large_image = "https://images.dog.ceo/breeds/pointer-germanlonghair/hans2.jpg"
dog_base64 = helpers.get_as_base64(large_image)
try:
self.spotify.playlist_upload_cover_image(self.new_playlist_uri, dog_base64)
except Exception as e:
self.assertIsInstance(e, SpotifyException)
self.assertEqual(e.http_status, 413)
return
self.fail()
def test_deprecated_starred(self): def test_deprecated_starred(self):
pl = self.spotify.user_playlist(self.username) pl = self.spotify.user_playlist(self.username)
self.assertTrue(pl["tracks"] is None) self.assertTrue(pl["tracks"] is None)