def similiar_artists self artist url http ws audioscrobbler com data d

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
def similiar_artists(self, artist):
url = 'http://ws.audioscrobbler.com/2.0/'
data = {}
data['method'] = 'artist.getsimilar'
data['artist'] = artist.encode('utf8')
data['api_key'] = self.api_key
post = urllib.urlencode(data)
xml = urllib2.urlopen(url, post).read()
parsed = minidom.parseString(xml)
artists_xml = parsed.getElementsByTagName('name')
return [a.childNodes[0].data for a in artists_xml]