Metadata-Version: 2.1
Name: pylastfmapi
Version: 0.1.0
Summary: An API library to interact with the LastFM API written in Python
License: MIT
Author: William Felipe
Author-email: theorangewill@gmail.com
Requires-Python: >=3.12,<4.0
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Dist: requests (>=2.32.3,<3.0.0)
Requires-Dist: requests-cache (>=1.2.1,<2.0.0)
Project-URL: Docmentation, https://pylastfmapi.readthedocs.io/en/latest/
Project-URL: Repository, https://github.com/theorangewill/pylastfmapi
Description-Content-Type: text/markdown

# pylastfmapi 

![CI](https://github.com/theorangewill/pylastfmapi/actions/workflows/pipeline.yaml/badge.svg)
[![Documentation Status](https://readthedocs.org/projects/pylastfmapi/badge/?version=latest)](https://pylastfmapi.readthedocs.io/en/latest/?badge=latest)

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](https://pylastfmapi.readthedocs.io/en/latest/).

## Installation

To install the package, use the following command:

```{.sh}
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](https://www.last.fm/join). With your user profile, create an API account [here](https://www.last.fm/api/account/create); 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`:

```{.py3}
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.

