data_garden data_garden - 7 months ago 22
Python Question

Python :: passing a list as parameter

responses
in
pyen
, a thin library for music data, returns dictionaries in this fashion:

{u'id': u'AR6SPRZ1187FB4958B', u'name': u'Wilco'}


I'm looping through and printing artists:

response = en.get('artist/search', artist_location='Chicago')

artists = response['artists']
for artist in artists:
sys.stdout.write("song by {}\n".format(artist['name']))


but I'd like to pass a list of
ids
here:

response = en.get('song/search', artist_ids = ?) //pass a list here?
for song in response['songs']:
sys.stdout.write("\t{}\n".format(song['title']))


Is this possible? How?

Answer

pyen is a very thin wrapper, you should always check the EchoNest API docs directly. According to the API documentation, the song/search endpoint does not accept multiple artist_ids.

Comments