Client Reference

class SpotanticClient(auth_manager: AuthManagerBase, *, max_attempts: int = 1, check_insufficient_scope: bool = True)

Bases: object

Client for interacting with the Spotify Web API.

This client handles HTTP requests to the Spotify API, including authentication, scope validation, and automatic retry logic with exponential backoff for transient failures (authorization and rate limit errors).

async request(request: RequestModel) RawAPIResponse

Execute an HTTP request described by request and return raw response.

Parameters:

requestRequestModel describing method, url, headers, params and body.

Returns:

Raw API response or None for empty responses.

async request_json(request: RequestModel) JsonAPIResponse

Execute an HTTP request described by request and return parsed response.

Parameters:

requestRequestModel describing method, url, headers, params and body.

Returns:

Parsed API response as Python object.

Raises:

SpotanticInvalidResponseError – If server response is empty or cannot be deserialized.