skip to navigation
skip to content

pylast 1.4.2

A Python interface to and


[![Build Status](]( [![PyPI version](]( [![PyPI downloads](]( [![Coverage Status](]( [![Code Health](](

A Python interface to []( and other api-compatible websites such as [](

Try using the pydoc utility for help on usage or see [](tests/ for examples.


Install via pip:

pip install pylast


* Simple public interface.
* Access to all the data exposed by the web services.
* Scrobbling support.
* Full object-oriented design.
* Proxy support.
* Internal caching support for some web services calls (disabled by default).
* Support for other API-compatible networks like
* Python 3-friendly (Starting from 0.5).

Getting Started

Here's a simple code example to get you started. In order to create any object from pyLast, you need a Network object which represents a social music network that is or any other API-compatible one. You can obtain a pre-configured one for and use it as follows:

import pylast

# You have to have your own unique two values for API_KEY and API_SECRET
# Obtain yours from for
API_KEY = "b25b959554ed76058ac220b7b2e0a026" # this is a sample key
API_SECRET = "425b55975eed76058ac220b7b4e8a054"

# In order to perform a write operation you need to authenticate yourself
username = "your_user_name"
password_hash = pylast.md5("your_password")

network = pylast.LastFMNetwork(api_key = API_KEY, api_secret =
API_SECRET, username = username, password_hash = password_hash)

# now you can use that object everywhere
artist = network.get_artist("System of a Down")

track = network.get_track("Iron Maiden", "The Nomad")
track.add_tags(("awesome", "favorite"))

# type help(pylast.LastFMNetwork) or help(pylast) in a Python interpreter to get more help
# about anything and see examples of how it works

More examples in <a href="">hugovk/lastfm-tools</a> and [](


[tests/](tests/ contains integration tests with, and plenty of code examples. Unit tests are also in the [tests/](tests/) directory.

For integration tests you need a test account at that will be cluttered with test data, and an API key and secret. Either copy [example_test_pylast.yaml](example_test_pylast.yaml) to test_pylast.yaml and fill out the credentials, or set them as environment variables like:


To run all unit and integration tests:
pip install pytest flaky

Or run just one test case:
py.test -k test_scrobble

To run with coverage:
py.test -v --cov pylast --cov-report term-missing
coverage report # for command-line report
coverage html # for HTML report
open htmlcov/index.html
File Type Py Version Uploaded on Size
pylast-1.4.2.tar.gz (md5) Source 2015-09-07 31KB
  • Downloads (All Versions):
  • 207 downloads in the last day
  • 1170 downloads in the last week
  • 5621 downloads in the last month