From 5860a5dc2c8d5232603a02a31eee332bd879f636 Mon Sep 17 00:00:00 2001 From: Johan Brodin Date: Thu, 9 Jun 2016 09:42:51 +0200 Subject: [PATCH] Added market parameter to user_playlist_tracks According to https://developer.spotify.com/web-api/get-playlists-tracks/ this endpoints supports an market option. This is important to specify if you want to ensure 'preview_url' on your tracks (https://github.com/spotify/web-api/issues/148) --- spotipy/client.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spotipy/client.py b/spotipy/client.py index be9162b..c3b4b69 100644 --- a/spotipy/client.py +++ b/spotipy/client.py @@ -353,7 +353,7 @@ class Spotify(object): return self._get("users/%s/playlists/%s" % (user, plid), fields=fields) def user_playlist_tracks(self, user, playlist_id = None, fields=None, - limit=100, offset=0): + limit=100, offset=0, market=None): ''' Get full details of the tracks of a playlist owned by a user. Parameters: @@ -362,10 +362,11 @@ class Spotify(object): - fields - which fields to return - limit - the maximum number of tracks to return - offset - the index of the first track to return + - market - an ISO 3166-1 alpha-2 country code. ''' plid = self._get_id('playlist', playlist_id) return self._get("users/%s/playlists/%s/tracks" % (user, plid), - limit=limit, offset=offset, fields=fields) + limit=limit, offset=offset, fields=fields, market=market) def user_playlist_create(self, user, name, public=True): ''' Creates a playlist for a user