Skip to main content

Official Python client for the Songstats Enterprise API

Project description

Songstats Python SDK

Official Python client for the Songstats Enterprise API.

📚 API Documentation: https://docs.songstats.com
🔑 API Key Access: Please contact api@songstats.com


Requirements

  • Python >= 3.10

Installation

Install from PyPI:

pip install songstats-sdk

For local development:

pip install -e ".[dev]"

Quick Start

from songstats_sdk import SongstatsClient

client = SongstatsClient(api_key="YOUR_API_KEY")

# API status
status = client.info.status()

# Track information
track = client.tracks.info(songstats_track_id="abcd1234")

# Artist statistics
artist_stats = client.artists.stats(
    songstats_artist_id="abcd1234",
    source="spotify",
)

Authentication

All requests include your API key in the apikey header.

You can generate an API key in your Songstats Enterprise dashboard.

We recommend storing your key securely in environment variables:

export SONGSTATS_API_KEY=your_key_here

Available Resource Clients

  • client.info
  • client.tracks
  • client.artists
  • client.collaborators
  • client.labels

Info endpoints:

  • client.info.sources() -> /sources
  • client.info.status() -> /status
  • client.info.definitions() -> /definitions

Error Handling

from songstats_sdk import SongstatsAPIError, SongstatsTransportError

try:
    client.tracks.info(songstats_track_id="invalid")
except SongstatsAPIError as exc:
    print(f"API error: {exc}")
except SongstatsTransportError as exc:
    print(f"Transport error: {exc}")

Development

To work on the SDK locally:

git clone https://github.com/songstats/songstats-python-sdk.git
cd songstats-python-sdk
pip install -e ".[dev]"
pytest

Versioning

This SDK follows Semantic Versioning (SemVer).


License

MIT

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

songstats_sdk-0.1.1.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

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

songstats_sdk-0.1.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file songstats_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: songstats_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for songstats_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 21df3d83fa3cad39a9625b98a31c0473dacdbafbd6798327ee5f45e6dc989e8d
MD5 8e197d52575cd40922416c16fece0a00
BLAKE2b-256 009030badb1b02fa3057c8fd72fd29a2ad98288b47d165aa7ede20e20d777dce

See more details on using hashes here.

File details

Details for the file songstats_sdk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: songstats_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for songstats_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b089b78389c9154cbb3e0f2bfa7bec5f95f90cea51230bb1e6764ea8bc782753
MD5 6ac0548e169b2db475956331fe7bf828
BLAKE2b-256 4d33efe85010a5b7902378e34cef050ee7a2bce094cfc979c60d630da8955589

See more details on using hashes here.

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