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.0.tar.gz (7.9 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.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: songstats_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 7.9 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.0.tar.gz
Algorithm Hash digest
SHA256 c105d2cd82a92e32d9b1f075c359ec7799e8c26f27e099c5c537b67a8d39fe85
MD5 a6875fe296cfcd15d4641ff80d3d4190
BLAKE2b-256 687fd44468d8b3174ae15bd0e976d6f0728cad1daac1e93ce5557b9c39e1c10e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: songstats_sdk-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 358c3ca5ce1bfb949242773a8bf090087000012f39fdab359aa73b0991e29ee7
MD5 4a9af01a555223101a2fe440c221fd1c
BLAKE2b-256 ae54ac97f58cb9a1ca7427b15db241d4a4c17f79053857e37ccf704a5cda6276

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