Skip to main content

Lazy Last.FM API bindings

Project description

[![Build Status](](


Lazy LastFM API bindings in python. Currently supports the following LastFM API methods:

- `track.*`
- `user.*`


Paginated API methods (i.e. methods that accept `page` and `limit` parameters) automatically query all results, returning a `PaginatedIterator`. This works like a standard iterator, except that it provides the `pages` attribute, which is the same as the total number of API requests it will take to exhaus all results. It also provides the `map` method, which works the same as the `map` function, except that it produces another `PaginatedIterator`.


>>> from pylastfm import LastFM

>>> # Current, only password authentication is supported
>>> client = LastFM('api_key', 'api_secret', username='username', password='password')

>>> tracks = client.user.get_loved_tracks('some_user')
>>> tracks
<PaginatedIterator(5 pages)>

>>> track = next(tracks)
>>> track
<pylastfm.response.common.Track at 0x102458a50>

>>> '{0} - {1}'.format(track.artist_name,
'Low - On My Own'

>>> track.to_dict()
{'artist_mbid': u'0c39e6da-14c7-4d7e-954f-a3fbd6ab7225',
'artist_name': u'Low',
'artist_url': u'0c39e6da-14c7-4d7e-954f-a3fbd6ab7225',
'date': datetime.datetime(2015, 4, 17, 18, 54),
'images': {u'extralarge': u'',
u'large': u'',
u'medium': u'',
u'small': u''},
'mbid': u'9afc711b-42cd-4ddc-9a29-f9a39cf47891',
'name': u'On My Own',
'streamable': None,
'url': u''}

>>> other_tracks = list(tracks)
>>> len(other_tracks)

>>> client.track.unlove(track.artist_name,

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pylastfm, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size pylastfm-0.1.0.tar.gz (16.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page