mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 09:13:53 +00:00
* test_improvements - Add __init__.py files to tests dirs so you can run all tests * test_improvements - added helpers file, restructured tests to work without previous data and to be grouped with api type * http_retries - Implement Retry for all requests * Readme - Update README with contributing info * PR Feedback - Added CONTRIBUTING.md, fixed README, fixed test
20 lines
582 B
Python
20 lines
582 B
Python
import base64
|
|
import requests
|
|
|
|
|
|
def get_spotify_playlist(spotify_object, playlist_name, username):
|
|
playlists = spotify_object.user_playlists(username)
|
|
while playlists:
|
|
for item in playlists['items']:
|
|
if item['name'] == playlist_name:
|
|
return item
|
|
playlists = spotify_object.next(playlists)
|
|
|
|
|
|
def create_spotify_playlist(spotify_object, playlist_name, username):
|
|
return spotify_object.user_playlist_create(username, playlist_name)
|
|
|
|
|
|
def get_as_base64(url):
|
|
return base64.b64encode(requests.get(url).content).decode("utf-8")
|