python-lastfm


A python interface to the last.fm web services API

This package provides a python interface to the last.fm web services API located at http://ws.audioscrobbler.com/2.0/ (documented at http://www.last.fm/api/intro).

The package covers all the methods provided by the web service API. It also contains some composite methods built upon the methods provided by the web service API. Authentication and authenticated methods are supported.

The code is being documented now. You can see the documentation here for reference.

Examples

```

import lastfm api_key = '23caa86333d2cb2055fa82129802780a' api = lastfm.Api(api_key) user = api.get_user('abhin4v') top_artists = user.top_artists for artist in top_artists[:20]: ... print "%s. %s (%s playcounts)" % (artist.stats.rank, artist.name, artist.stats.playcount) ... 1. Bon Jovi (5951 playcounts) 2. Bryan Adams (3564 playcounts) 3. U2 (2264 playcounts) 4. Aerosmith (2197 playcounts) 5. Nelly Furtado (1763 playcounts) 6. Pink Floyd (1477 playcounts) 7. Avril Lavigne (1287 playcounts) 8. Dream Theater (1208 playcounts) 9. the pillows (1121 playcounts) 10. The Corrs (990 playcounts) 11. Green Day (968 playcounts) 12. Linkin Park (916 playcounts) 13. Def Leppard (846 playcounts) 14. Roxette (753 playcounts) 15. Lynyrd Skynyrd (747 playcounts) 16. Poets of the Fall (729 playcounts) 17. 3 Doors Down (727 playcounts) 18. Coldplay (708 playcounts) 19. Maroon 5 (707 playcounts) 20. Dire Straits (688 playcounts) ```

```

import lastfm api_key = '23caa86333d2cb2055fa82129802780a' api = lastfm.Api(api_key) artist = api.get_artist('Bon Jovi') similar_artists = artist.similar for i,a in enumerate(similar_artists[:10]): ... print "%s. %s (%s%% similar)" % ((i+1), a.name, a.stats.match) ... 1. Jon Bon Jovi (100.0% similar) 2. Richie Sambora (94.83% similar) 3. Def Leppard (27.33% similar) 4. Bryan Adams (24.75% similar) 5. Aerosmith (20.68% similar) 6. Europe (18.99% similar) 7. Whitesnake (18.64% similar) 8. Poison (18.44% similar) 9. Firehouse (17.75% similar) 10. Skid Row (17.62% similar) ```

Project Information

Labels:
python last.fm API