Skip to main content

Async typed Python client for Deezer's Pipe GraphQL API.

Project description

deezer-python-gql

Async typed Python client for Deezer's Pipe GraphQL API.

Built with ariadne-codegen — all client methods and response models are generated from the GraphQL schema and .graphql query files.

Installation

uv add deezer-python-gql

Quick Start

import asyncio

from deezer_python_gql import DeezerGQLClient

async def main():
    client = DeezerGQLClient(arl="YOUR_ARL_COOKIE")

    # Current user
    me = await client.get_me()
    print(me)

    # Track with media URLs, lyrics, and contributors
    track = await client.get_track(track_id="3135556")
    print(track.title, track.duration)

    # Album with paginated track list
    album = await client.get_album(album_id="302127")
    print(album.display_title, album.tracks_count)

    # Artist with top tracks and discography
    artist = await client.get_artist(artist_id="27")
    print(artist.name, artist.fans_count)

    # Playlist with tracks
    playlist = await client.get_playlist(playlist_id="53362031")
    print(playlist.title, playlist.estimated_tracks_count)

    # Unified search across all entity types
    results = await client.search(query="Daft Punk")
    print(len(results.tracks.edges), "tracks found")

asyncio.run(main())

Available Queries

Method Description
get_me() Current authenticated user
get_track(track_id) Full track details — ISRC, media tokens, lyrics, contributors
get_album(album_id) Album with cover, label, paginated tracks, fallback
get_artist(artist_id) Artist with bio, top tracks, albums (ordered by release date)
get_playlist(playlist_id) Playlist with owner, picture, paginated tracks
search(query, ...) Unified search across tracks, albums, artists, playlists

All methods return fully-typed Pydantic models generated from the GraphQL schema.

Development

Requires Python 3.12+ and uv.

# Install all dependencies (including codegen tooling)
make setup

# Re-generate the typed client from schema + queries
make generate

# Run linters and type checks
make lint

# Run tests
make test

Adding a new query

  1. Create a .graphql file in queries/.
  2. Run make generate to produce the typed client method and response models.
  3. Add tests in tests/.

Exploring the API

To run ad-hoc GraphQL queries against the live Pipe API during development:

  1. Create a .env file (already gitignored) with your ARL cookie:

    echo 'DEEZER_ARL=your_arl_cookie_value' > .env
    
  2. Run queries:

    # Run a .graphql file
    uv run python scripts/explore.py queries/get_me.graphql
    
    # Run an inline query
    uv run python scripts/explore.py -q '{ me { id } }'
    
    # With variables
    uv run python scripts/explore.py -q 'query($id: String!) { track(trackId: $id) { title } }' \
        -v '{"id": "3135556"}'
    
    # Via make
    make explore Q=queries/get_me.graphql
    

The script handles JWT auth automatically — no manual token management needed.

Authentication

The Pipe API uses short-lived JWTs obtained from an ARL cookie. The base client handles token acquisition and refresh automatically — you only need to supply a valid ARL value.

License

Apache-2.0

Project details


Download files

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

Source Distribution

deezer_python_gql-0.1.0.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deezer_python_gql-0.1.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file deezer_python_gql-0.1.0.tar.gz.

File metadata

  • Download URL: deezer_python_gql-0.1.0.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for deezer_python_gql-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6eca18e289da3373a1ce722f9c9797eaee1a75eff10300ee7f17a26406ad7313
MD5 66b5125b92e2975e54556b2a3957c5a3
BLAKE2b-256 6b46ec3a1a2320d4ec70bc96e099f0a40e99cdae126b572eb807cce5192e6a36

See more details on using hashes here.

Provenance

The following attestation bundles were made for deezer_python_gql-0.1.0.tar.gz:

Publisher: publish-to-pypi.yml on music-assistant/deezer-python-gql

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file deezer_python_gql-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for deezer_python_gql-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2032577637846bd38145985c4bd587309ae492eb2b0d0e8b8a1e4cded6760692
MD5 291ca17d1b546e1284c7013bd017fb73
BLAKE2b-256 f988e0a74f217d47d65efa1b115fc6ce228a3af076f53a0b00c65a80084dad3b

See more details on using hashes here.

Provenance

The following attestation bundles were made for deezer_python_gql-0.1.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on music-assistant/deezer-python-gql

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page