An API library to interact with the LastFM API written in Python
Project description
pylastfmapi
This package provides an interface to interact with the LastFM API. It includes methods to retrieve various types of data from albums, artists, tracks, tags, users, LastFM charts, and user charts.
Read the docs here.
Installation
To install the package, use the following command:
pip install pylastfmapi
Basic usage
Get an API key
First of all, you need to get an API key from LastFM official website. For this, you will need a LastFM account here. With your user profile, create an API account here; you only need the contact email and application name and an API key will be given to you.
Go to Python script
To interact with the LastFM API you can simply import pylastfmapi and create a LastFM client object with your username as USER_AGENT and the API key from the previous step as API_KEY:
from pylastfmapi.client import LastFM
# Your LastFM API credentials
USER_AGENT = 'user-agent'
API_KEY = 'api-key'
# Initialize the LastFM client with your USER_AGENT and API_KEY
client = LastFM(USER_AGENT, API_KEY)
# Fetch information about a specific artist
artist_info = client.get_artist_info(artist="Miley Cyrus")
print(artist_info)
# {'name': 'Miley Cyrus', 'mbid': '7e9bd05a-117f-4cce-8...
Error Handling
The package raises LastFMException for various error conditions such as invalid parameters or request limits.
Handle these exceptions to ensure your application can gracefully manage errors.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pylastfmapi-0.1.0.tar.gz.
File metadata
- Download URL: pylastfmapi-0.1.0.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.10.3-200.fc40.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8db851ecba6bcc7de90f7cd5e134567c524b73f8197925c66152bd5b01d1f483
|
|
| MD5 |
e25b149fb1382e8333335c2a9af0df37
|
|
| BLAKE2b-256 |
8ae50d493f0c9e60371aaf187f9013ee22f284d239a0b0d51e82e6776e87293c
|
File details
Details for the file pylastfmapi-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pylastfmapi-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.10.3-200.fc40.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19c438c8c6fcbbabf80fbc178d2430e3e99e26899569caceae55f28ed91d0a23
|
|
| MD5 |
06665edd4b8eb41e77eedb1ee0ba5beb
|
|
| BLAKE2b-256 |
38b9931317de1fc5252dec073602e2dd3a490b0d0dec1f41af2b8f44657273a4
|