Skip to content

Commit ef2ed1a

Browse files
Bump to 2.17.0
1 parent 4e1e74b commit ef2ed1a

File tree

5 files changed

+59
-4
lines changed

5 files changed

+59
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
## Unreleased
1010

11+
// Add your changes here and then delete this line
12+
13+
## [2.17.0] - 2021-02-28
14+
1115
### Changed
1216

1317
- moved os.remove(session_cache_path()) inside try block to avoid TypeError on app.py example file

CONTRIBUTING.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,28 @@ To make sure if the import lists are stored correctly:
3636
pip install isort
3737
isort . -c -v
3838

39+
### Publishing (by maintainer)
40+
41+
- Bump version in setup.py
42+
- Bump and date changelog
43+
- Add to changelog:
44+
45+
## Unreleased
46+
47+
// Add your changes here and then delete this line
48+
49+
- Commit changes
50+
- Package to pypi:
51+
52+
python setup.py sdist bdist_wheel
53+
python3 setup.py sdist bdist_wheel
54+
twine check dist/*
55+
twine upload --skip-existing dist/*.whl dist/*.gz dist/*.zip
56+
57+
- Create github release https://github.com/plamere/spotipy/releases with the changelog content
58+
for the version and a short name that describes the main addition
59+
- Verify doc uses latest https://readthedocs.org/projects/spotipy/
60+
3961
### Changelog
4062

4163
Don't forget to add a short description of your change in the [CHANGELOG](CHANGELOG.md)

docs/index.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,23 @@ IDs URIs and URLs
212212
In general, any *Spotipy* method that needs an artist, album, track or playlist ID
213213
will accept ids in any of the above form
214214

215+
216+
Customized token caching
217+
========================
218+
219+
Tokens are refreshed automatically and stored by default in the project main folder.
220+
As this might not suit everyone's needs, spotipy provides a way to create customized
221+
cache handlers.
222+
223+
https://github.com/plamere/spotipy/blob/master/spotipy/cache_handler.py
224+
225+
The custom cache handler would need to be a class that inherits from the base
226+
cache handler ``CacheHandler``. The default cache handler ``CacheFileHandler`` is a good example.
227+
An instance of that new class can then be passed as a parameter when
228+
creating ``SpotifyOAuth``, ``SpotifyPKCE`` or ``SpotifyImplicitGrant``.
229+
230+
Feel free to contribute new cache handlers to the repo.
231+
215232
Examples
216233
=======================
217234

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
setup(
2020
name='spotipy',
21-
version='2.16.1',
21+
version='2.17.0',
2222
description='A light weight Python library for the Spotify Web API',
2323
long_description=long_description,
2424
long_description_content_type="text/markdown",

tests/integration/test_user_endpoints.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ def test_playlist_add_episodes(self):
165165
self.assertEqual(playlist["total"], 0)
166166

167167
def test_playlist_cover_image(self):
168-
# Upload random dog image
169-
r = requests.get('https://dog.ceo/api/breeds/image/random')
170-
dog_base64 = helpers.get_as_base64(r.json()['message'])
168+
# From https://dog.ceo/api/breeds/image/random
169+
small_image = "https://images.dog.ceo/breeds/poodle-toy/n02113624_8936.jpg"
170+
dog_base64 = helpers.get_as_base64(small_image)
171171
self.spotify.playlist_upload_cover_image(self.new_playlist_uri, dog_base64)
172172

173173
res = self.spotify.playlist_cover_image(self.new_playlist_uri)
@@ -177,6 +177,18 @@ def test_playlist_cover_image(self):
177177
self.assertIn('height', first_image)
178178
self.assertIn('url', first_image)
179179

180+
def test_large_playlist_cover_image(self):
181+
# From https://dog.ceo/api/breeds/image/random
182+
large_image = "https://images.dog.ceo/breeds/pointer-germanlonghair/hans2.jpg"
183+
dog_base64 = helpers.get_as_base64(large_image)
184+
try:
185+
self.spotify.playlist_upload_cover_image(self.new_playlist_uri, dog_base64)
186+
except Exception as e:
187+
self.assertIsInstance(e, SpotifyException)
188+
self.assertEqual(e.http_status, 413)
189+
return
190+
self.fail()
191+
180192
def test_deprecated_starred(self):
181193
pl = self.spotify.user_playlist(self.username)
182194
self.assertTrue(pl["tracks"] is None)

0 commit comments

Comments
 (0)