From f5bb6db89f1c524cff256d2a5191782ee4c92e60 Mon Sep 17 00:00:00 2001 From: Nathan Coleman Date: Fri, 2 Jun 2017 18:51:38 -0500 Subject: [PATCH] Add support for description field on playlist create/update --- spotipy/client.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/spotipy/client.py b/spotipy/client.py index ad0e082..c4d9793 100644 --- a/spotipy/client.py +++ b/spotipy/client.py @@ -399,20 +399,21 @@ class Spotify(object): limit=limit, offset=offset, fields=fields, market=market) - def user_playlist_create(self, user, name, public=True): + def user_playlist_create(self, user, name, public=True, description=''): ''' Creates a playlist for a user Parameters: - user - the id of the user - name - the name of the playlist - public - is the created playlist public + - description - the description of the playlist ''' - data = {'name': name, 'public': public} + data = {'name': name, 'public': public, 'description': description} return self._post("users/%s/playlists" % (user,), payload=data) def user_playlist_change_details( self, user, playlist_id, name=None, public=None, - collaborative=None): + collaborative=None, description=None): ''' Changes a playlist's name and/or public/private state Parameters: @@ -421,6 +422,7 @@ class Spotify(object): - name - optional name of the playlist - public - optional is the playlist public - collaborative - optional is the playlist collaborative + - description - optional description of the playlist ''' data = {} if isinstance(name, six.string_types): @@ -429,6 +431,8 @@ class Spotify(object): data['public'] = public if isinstance(collaborative, bool): data['collaborative'] = collaborative + if isinstance(description, six.string_types): + data['description'] = description return self._put("users/%s/playlists/%s" % (user, playlist_id), payload=data)