From e2b03937e70dae73437b7ff7f7386bc1edb3ca91 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Date: Wed, 4 Jan 2017 17:20:47 -0200 Subject: [PATCH] Update client.py Added a check if basestring class exists (Python2 case). If doesn't exist, alias `basestring` to `str` (Python3 case). --- spotipy/client.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spotipy/client.py b/spotipy/client.py index 5f120b0..d2542ab 100644 --- a/spotipy/client.py +++ b/spotipy/client.py @@ -418,7 +418,12 @@ class Spotify(object): - collaborative - optional is the playlist collaborative ''' data = {} - if isinstance(name, str): + # Add Python2 and Python3 compatibility checking string types + try: + basestring + except NameError: + basestring = str + if isinstance(name, basestring): data['name'] = name if isinstance(public, bool): data['public'] = public