Skip to content

test PyPI version Documentation Status codecov License: MIT Code style: black Imports: isort PyPI - Python Version

setlist-fm-client🔗

setlist-fm-client is a python client for the setlist.fm REST API.

  • it uses pydantic for lightning fast data serialization
  • it uses httpx to provide both a sync and async api

Installation🔗

pip install setlist-fm-client
poetry add setlist-fm-client

Authentication🔗

In order to authenticate to the setlist.fm REST API, you must apply for an API key (link for logged-in users only) - if you're not registered user yet, then register first (it's free).

Once you have your key, you can use it in the setlist-fm-client by setting the SETLIST_FM_API_KEY environment variable or by passing api_key="xxx" as a kwarg to any function (see examples below).

import os

import setlist_fm_client

os.environ["SETLIST_FM_API_KEY"] = "xxx"
response = setlist_fm_client.get_artist_setlists("0bfba3d3-6a04-4779-bb0a-df07df5b0558")
import setlist_fm_client

response = setlist_fm_client.get_artist_setlists("0bfba3d3-6a04-4779-bb0a-df07df5b0558", api_key="xxx")

Simple Example🔗

setlist-fm-client is extremely easy to use. By setting serialize=True, you get a pydantic model returned to you instead of a httpx.Response object.

Below are examples of what the code looks like for both the sync and async apis.

import setlist_fm_client

setlists = setlist_fm_client.get_artist_setlists(
    "0bfba3d3-6a04-4779-bb0a-df07df5b0558", api_key="xxx", serialize=True
)
print(setlists)
import asyncio 

import setlist_fm_client

async def main():
    setlists = await setlist_fm_client.get_artist_setlists(
        "0bfba3d3-6a04-4779-bb0a-df07df5b0558", api_key="xxx", serialize=True
    )
    print(setlists)

asyncio.run(main())

This will give you an ArtistSetListResponse object.