Update client.py

Added a check if basestring class exists (Python2 case). If doesn't exist, alias `basestring` to `str` (Python3 case).
This commit is contained in:
Carlos Eduardo 2017-01-04 17:20:47 -02:00 committed by GitHub
parent 463d6c0878
commit e2b03937e7
1 changed files with 6 additions and 1 deletions

View File

@ -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