Models

Response model definitions for client.

Responses are parsed into Pydantic models. This allows accessing parts of the response directly as attributes. Further documentation on specific attribute values can be viewed in the Web API reference.

import tekore as tk

# Call the API
spotify = tk.Spotify(token)
album = spotify.album('3RBULTZJ97bvVzZLpxcB0j')

# Use the response
for track in album.tracks.items:
    print(track.track_number, track.name)

Using Pydantic models means that responses are easy to work with. They provide a readable repr (particularly with devtools) for quick inspection, and it is also possible to convert models to builtin and JSON representations:

from pprint import pprint

print(album)
pprint(album, depth=2)

album.dict()
album.json()

Responses will sometimes contain unknown attributes when the API changes. They are ignored when parsing the response model, but a UnknownModelAttributeWarning is issued when encountering one. Please consider upgrading Tekore if a newer version documents and handles it.

Models are made available in the tekore.models namespace.

Album

Album

Album base.

AlbumGroup

Relationship between artist and album.

AlbumType

Type of album.

SimpleAlbum

Simplified album object.

SimpleAlbumPaging

Paging containing simplified albums.

FullAlbum

Complete album object.

SavedAlbum

Album saved to library.

SavedAlbumPaging

Paging of albums in library.

class tekore.model.Album(*, id, href, type, uri, album_type, artists, external_urls, images, name, total_tracks, release_date, release_date_precision, available_markets=None, is_playable=None)

Bases: Item

Album base.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • album_type (AlbumType) –

  • artists (list[SimpleArtist]) –

  • external_urls (dict) –

  • images (list[Image]) –

  • name (str) –

  • total_tracks (int) –

  • release_date (str) –

  • release_date_precision (ReleaseDatePrecision) –

  • available_markets (list[str] | None) –

  • is_playable (bool | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.AlbumGroup(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: StrEnum

Relationship between artist and album.

album = 'album'
appears_on = 'appears_on'
compilation = 'compilation'
single = 'single'
class tekore.model.AlbumType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: StrEnum

Type of album.

album = 'album'
compilation = 'compilation'
ep = 'ep'
single = 'single'
class tekore.model.SimpleAlbum(*, id, href, type, uri, album_type, artists, external_urls, images, name, total_tracks, release_date, release_date_precision, available_markets=None, is_playable=None, album_group=None)

Bases: Album

Simplified album object.

album_group is available when getting an artist’s albums. available_markets is available when market is not specified.

The presence of is_playable is undocumented and it appears to only be True when it is present.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • album_type (AlbumType) –

  • artists (list[SimpleArtist]) –

  • external_urls (dict) –

  • images (list[Image]) –

  • name (str) –

  • total_tracks (int) –

  • release_date (str) –

  • release_date_precision (ReleaseDatePrecision) –

  • available_markets (list[str] | None) –

  • is_playable (bool | None) –

  • album_group (AlbumGroup | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.SimpleAlbumPaging(*, href, items, limit, next, total, offset, previous)

Bases: OffsetPaging

Paging containing simplified albums.

Parameters:
  • href (str) –

  • items (list[SimpleAlbum]) –

  • limit (int) –

  • next (str | None) –

  • total (int) –

  • offset (int) –

  • previous (str | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.FullAlbum(*, id, href, type, uri, album_type, artists, external_urls, images, name, total_tracks, release_date, release_date_precision, available_markets=None, is_playable=None, copyrights, external_ids, genres, label, popularity, tracks)

Bases: Album

Complete album object.

available_markets is available when market is not specified.

The presence of is_playable is undocumented and it appears to only be True when it is present.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • album_type (AlbumType) –

  • artists (list[SimpleArtist]) –

  • external_urls (dict) –

  • images (list[Image]) –

  • name (str) –

  • total_tracks (int) –

  • release_date (str) –

  • release_date_precision (ReleaseDatePrecision) –

  • available_markets (list[str] | None) –

  • is_playable (bool | None) –

  • copyrights (list[Copyright]) –

  • external_ids (dict) –

  • genres (list[str]) –

  • label (str | None) –

  • popularity (int) –

  • tracks (SimpleTrackPaging) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.SavedAlbum(*, added_at, album)

Bases: Model

Album saved to library.

Parameters:
  • added_at (datetime) –

  • album (FullAlbum) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.SavedAlbumPaging(*, href, items, limit, next, total, offset, previous)

Bases: OffsetPaging

Paging of albums in library.

Parameters:
  • href (str) –

  • items (list[SavedAlbum]) –

  • limit (int) –

  • next (str | None) –

  • total (int) –

  • offset (int) –

  • previous (str | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Artist

Artist

Artist base.

SimpleArtist

Simplified artist object.

FullArtist

Complete artist object.

FullArtistCursorPaging

Paging of full artists.

FullArtistOffsetPaging

Paging of full artists.

class tekore.model.Artist(*, id, href, type, uri, external_urls, name)

Bases: Item

Artist base.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • external_urls (dict) –

  • name (str) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.SimpleArtist(*, id, href, type, uri, external_urls, name)

Bases: Artist

Simplified artist object.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • external_urls (dict) –

  • name (str) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.FullArtist(*, id, href, type, uri, external_urls, name, followers, genres, images, popularity)

Bases: Artist

Complete artist object.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • external_urls (dict) –

  • name (str) –

  • followers (Followers) –

  • genres (list[str]) –

  • images (list[Image]) –

  • popularity (int) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.FullArtistCursorPaging(*, href, items, limit, next, cursors, total)

Bases: CursorPaging

Paging of full artists.

Parameters:
  • href (str) –

  • items (list[FullArtist]) –

  • limit (int) –

  • next (str | None) –

  • cursors (Cursor) –

  • total (int) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.FullArtistOffsetPaging(*, href, items, limit, next, total, offset, previous)

Bases: OffsetPaging

Paging of full artists.

Parameters:
  • href (str) –

  • items (list[FullArtist]) –

  • limit (int) –

  • next (str | None) –

  • total (int) –

  • offset (int) –

  • previous (str | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Audiobook

Audiobook

Audiobook base.

SimpleAudiobook

Simplified audiobook.

SimpleAudiobookPaging

Paging of simplified audiobooks.

FullAudiobook

Complete audiobook object.

Author

Audiobook author.

Narrator

Audiobook narrator.

class tekore.model.Audiobook(*, id, href, type, uri, authors, available_markets=None, copyrights, description, edition, explicit, external_urls, html_description, images, is_externally_hosted=None, languages, media_type, name, narrators, publisher, total_chapters)

Bases: Item

Audiobook base.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • authors (list[Author]) –

  • available_markets (list[str] | None) –

  • copyrights (list[Copyright]) –

  • description (str) –

  • edition (str | None) –

  • explicit (bool) –

  • external_urls (dict) –

  • html_description (str) –

  • images (list[Image]) –

  • is_externally_hosted (bool | None) –

  • languages (list[str]) –

  • media_type (str) –

  • name (str) –

  • narrators (list[Narrator]) –

  • publisher (str) –

  • total_chapters (int | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.SimpleAudiobook(*, id, href, type, uri, authors, available_markets=None, copyrights, description, edition, explicit, external_urls, html_description, images, is_externally_hosted=None, languages, media_type, name, narrators, publisher, total_chapters, chapters=None)

Bases: Audiobook

Simplified audiobook.

May contain chapters, but that is likely an error.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • authors (list[Author]) –

  • available_markets (list[str] | None) –

  • copyrights (list[Copyright]) –

  • description (str) –

  • edition (str | None) –

  • explicit (bool) –

  • external_urls (dict) –

  • html_description (str) –

  • images (list[Image]) –

  • is_externally_hosted (bool | None) –

  • languages (list[str]) –

  • media_type (str) –

  • name (str) –

  • narrators (list[Narrator]) –

  • publisher (str) –

  • total_chapters (int | None) –

  • chapters (dict | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.SimpleAudiobookPaging(*, href, items, limit, next, total, offset, previous)

Bases: OffsetPaging

Paging of simplified audiobooks.

Parameters:
  • href (str) –

  • items (list[SimpleAudiobook]) –

  • limit (int) –

  • next (str | None) –

  • total (int) –

  • offset (int) –

  • previous (str | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.FullAudiobook(*, id, href, type, uri, authors, available_markets=None, copyrights, description, edition, explicit, external_urls, html_description, images, is_externally_hosted=None, languages, media_type, name, narrators, publisher, total_chapters, chapters, is_playable=None)

Bases: Audiobook

Complete audiobook object.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • authors (list[Author]) –

  • available_markets (list[str] | None) –

  • copyrights (list[Copyright]) –

  • description (str) –

  • edition (str | None) –

  • explicit (bool) –

  • external_urls (dict) –

  • html_description (str) –

  • images (list[Image]) –

  • is_externally_hosted (bool | None) –

  • languages (list[str]) –

  • media_type (str) –

  • name (str) –

  • narrators (list[Narrator]) –

  • publisher (str) –

  • total_chapters (int | None) –

  • chapters (SimpleChapterPaging) –

  • is_playable (bool | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.Author(*, name)

Bases: Model

Audiobook author.

Parameters:

name (str) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.Narrator(*, name)

Bases: Model

Audiobook narrator.

Parameters:

name (str) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Category

Category

Spotify tag category.

CategoryPaging

Paging of categories.

class tekore.model.Category(*, id, href, icons, name)

Bases: Identifiable

Spotify tag category.

Parameters:
  • id (str) –

  • href (str) –

  • icons (list[Image]) –

  • name (str) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.CategoryPaging(*, href, items, limit, next, total, offset, previous)

Bases: OffsetPaging

Paging of categories.

Parameters:
  • href (str) –

  • items (list[Category]) –

  • limit (int) –

  • next (str | None) –

  • total (int) –

  • offset (int) –

  • previous (str | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Chapter

Chapter

Audiobook chapter base.

SimpleChapter

Simplified chapter.

SimpleChapterPaging

Paging of simplified chapters.

FullChapter

Complete chapter object.

class tekore.model.Chapter(*, id, href, type, uri, audio_preview_url, available_markets=None, chapter_number, description, duration_ms, explicit, external_urls, html_description, images, is_playable=None, languages, name, release_date_precision, release_date, restrictions=None, resume_point=None)

Bases: Item

Audiobook chapter base.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • audio_preview_url (str | None) –

  • available_markets (list[str] | None) –

  • chapter_number (int) –

  • description (str) –

  • duration_ms (int) –

  • explicit (bool) –

  • external_urls (dict) –

  • html_description (str) –

  • images (list[Image]) –

  • is_playable (bool | None) –

  • languages (list[str]) –

  • name (str) –

  • release_date_precision (ReleaseDatePrecision) –

  • release_date (str) –

  • restrictions (Restrictions | None) –

  • resume_point (ResumePoint | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.SimpleChapter(*, id, href, type, uri, audio_preview_url, available_markets=None, chapter_number, description, duration_ms, explicit, external_urls, html_description, images, is_playable=None, languages, name, release_date_precision, release_date, restrictions=None, resume_point=None)

Bases: Chapter

Simplified chapter.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • audio_preview_url (str | None) –

  • available_markets (list[str] | None) –

  • chapter_number (int) –

  • description (str) –

  • duration_ms (int) –

  • explicit (bool) –

  • external_urls (dict) –

  • html_description (str) –

  • images (list[Image]) –

  • is_playable (bool | None) –

  • languages (list[str]) –

  • name (str) –

  • release_date_precision (ReleaseDatePrecision) –

  • release_date (str) –

  • restrictions (Restrictions | None) –

  • resume_point (ResumePoint | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.SimpleChapterPaging(*, href, items, limit, next, total, offset, previous)

Bases: OffsetPaging

Paging of simplified chapters.

Parameters:
  • href (str) –

  • items (list[SimpleChapter]) –

  • limit (int) –

  • next (str | None) –

  • total (int) –

  • offset (int) –

  • previous (str | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.FullChapter(*, id, href, type, uri, audio_preview_url, available_markets=None, chapter_number, description, duration_ms, explicit, external_urls, html_description, images, is_playable=None, languages, name, release_date_precision, release_date, restrictions=None, resume_point=None, audiobook)

Bases: Chapter

Complete chapter object.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • audio_preview_url (str | None) –

  • available_markets (list[str] | None) –

  • chapter_number (int) –

  • description (str) –

  • duration_ms (int) –

  • explicit (bool) –

  • external_urls (dict) –

  • html_description (str) –

  • images (list[Image]) –

  • is_playable (bool | None) –

  • languages (list[str]) –

  • name (str) –

  • release_date_precision (ReleaseDatePrecision) –

  • release_date (str) –

  • restrictions (Restrictions | None) –

  • resume_point (ResumePoint | None) –

  • audiobook (SimpleAudiobook) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Episode

Episode

Episode base.

SimpleEpisode

Simplified episode object.

SimpleEpisodePaging

Paging of simplified episodes.

FullEpisode

Complete episode object.

SavedEpisode

Episode saved to library.

SavedEpisodePaging

Paging of episodes in library.

ResumePoint

Resume point.

class tekore.model.Episode(*, id, href, type, uri, audio_preview_url, description, duration_ms, explicit, external_urls, html_description, images, is_externally_hosted, is_playable=None, language=None, languages, name, release_date, release_date_precision, resume_point=None)

Bases: Item

Episode base.

language is deprecated.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • audio_preview_url (str | None) –

  • description (str) –

  • duration_ms (int) –

  • explicit (bool) –

  • external_urls (dict) –

  • html_description (str) –

  • images (list[Image]) –

  • is_externally_hosted (bool) –

  • is_playable (bool | None) –

  • language (str | None) –

  • languages (list[str]) –

  • name (str) –

  • release_date (str) –

  • release_date_precision (ReleaseDatePrecision) –

  • resume_point (ResumePoint | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.SimpleEpisode(*, id, href, type, uri, audio_preview_url, description, duration_ms, explicit, external_urls, html_description, images, is_externally_hosted, is_playable=None, language=None, languages, name, release_date, release_date_precision, resume_point=None)

Bases: Episode

Simplified episode object.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • audio_preview_url (str | None) –

  • description (str) –

  • duration_ms (int) –

  • explicit (bool) –

  • external_urls (dict) –

  • html_description (str) –

  • images (list[Image]) –

  • is_externally_hosted (bool) –

  • is_playable (bool | None) –

  • language (str | None) –

  • languages (list[str]) –

  • name (str) –

  • release_date (str) –

  • release_date_precision (ReleaseDatePrecision) –

  • resume_point (ResumePoint | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.SimpleEpisodePaging(*, href, items, limit, next, total, offset, previous)

Bases: OffsetPaging

Paging of simplified episodes.

Parameters:
  • href (str) –

  • items (list[SimpleEpisode]) –

  • limit (int) –

  • next (str | None) –

  • total (int) –

  • offset (int) –

  • previous (str | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.FullEpisode(*, id, href, type, uri, audio_preview_url, description, duration_ms, explicit, external_urls, html_description, images, is_externally_hosted, is_playable=None, language=None, languages, name, release_date, release_date_precision, resume_point=None, restrictions=None, show)

Bases: Episode

Complete episode object.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • audio_preview_url (str | None) –

  • description (str) –

  • duration_ms (int) –

  • explicit (bool) –

  • external_urls (dict) –

  • html_description (str) –

  • images (list[Image]) –

  • is_externally_hosted (bool) –

  • is_playable (bool | None) –

  • language (str | None) –

  • languages (list[str]) –

  • name (str) –

  • release_date (str) –

  • release_date_precision (ReleaseDatePrecision) –

  • resume_point (ResumePoint | None) –

  • restrictions (Restrictions | None) –

  • show (SimpleShow) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.SavedEpisode(*, added_at, episode)

Bases: Model

Episode saved to library.

Parameters:
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.SavedEpisodePaging(*, href, items, limit, next, total, offset, previous)

Bases: OffsetPaging

Paging of episodes in library.

Parameters:
  • href (str) –

  • items (list[SavedEpisode]) –

  • limit (int) –

  • next (str | None) –

  • total (int) –

  • offset (int) –

  • previous (str | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.ResumePoint(*, fully_played, resume_position_ms)

Bases: Model

Resume point.

Parameters:
  • fully_played (bool) –

  • resume_position_ms (int) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Playback

CurrentlyPlaying

Current playback.

CurrentlyPlayingContext

Extended current playback context.

CurrentlyPlayingType

Type of currently playing item.

Queue

Playback queue.

Device

Playback device.

DeviceType

Type of playback device.

Actions

Player actions.

Disallows

Disallowed player actions.

PlayerErrorReason

Reasons for errors in player actions.

RepeatState

Playback repeat state.

PlayHistory

Previously played track.

PlayHistoryCursor

Cursor to play history.

PlayHistoryPaging

Paging to play history.

Context

Context of a played track or episode.

ContextType

Type of player context.

Currently playing

class tekore.model.CurrentlyPlaying(*, actions, currently_playing_type, is_playing, timestamp, context, progress_ms, item)

Bases: Model

Current playback.

context, progress_ms and item may be None e.g. during a private session.

Parameters:
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.CurrentlyPlayingContext(*, actions, currently_playing_type, is_playing, timestamp, context, progress_ms, item, device, repeat_state, shuffle_state, smart_shuffle)

Bases: CurrentlyPlaying

Extended current playback context.

smart_shuffle is not documented in the Spotify API.

Parameters:
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.CurrentlyPlayingType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: StrEnum

Type of currently playing item.

ad = 'ad'
episode = 'episode'
track = 'track'
unknown = 'unknown'
class tekore.model.Queue(*, currently_playing, queue)

Bases: Model

Playback queue.

Parameters:
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.Device(*, id, is_active, is_private_session, is_restricted, name, type, volume_percent, supports_volume)

Bases: Identifiable

Playback device.

Parameters:
  • id (str) –

  • is_active (bool) –

  • is_private_session (bool) –

  • is_restricted (bool) –

  • name (str) –

  • type (DeviceType) –

  • volume_percent (int | None) –

  • supports_volume (bool) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.DeviceType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: StrEnum

Type of playback device.

AVR = 'AVR'
AudioDongle = 'AudioDongle'
Automobile = 'Automobile'
CastAudio = 'CastAudio'
CastVideo = 'CastVideo'
Computer = 'Computer'
GameConsole = 'GameConsole'
STB = 'STB'
Smartphone = 'Smartphone'
Speaker = 'Speaker'
TV = 'TV'
Tablet = 'Tablet'
Unknown = 'Unknown'
audiodongle = 'AudioDongle'
automobile = 'Automobile'
avr = 'AVR'
castaudio = 'CastAudio'
castvideo = 'CastVideo'
computer = 'Computer'
gameconsole = 'GameConsole'
smartphone = 'Smartphone'
speaker = 'Speaker'
stb = 'STB'
tablet = 'Tablet'
tv = 'TV'
unknown = 'Unknown'
class tekore.model.Actions(*, disallows)

Bases: Model

Player actions.

Parameters:

disallows (Disallows) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.Disallows(*, interrupting_playback=False, pausing=False, resuming=False, seeking=False, skipping_next=False, skipping_prev=False, toggling_repeat_context=False, toggling_shuffle=False, toggling_repeat_track=False, transferring_playback=False)

Bases: Model

Disallowed player actions.

Parameters:
  • interrupting_playback (bool) –

  • pausing (bool) –

  • resuming (bool) –

  • seeking (bool) –

  • skipping_next (bool) –

  • skipping_prev (bool) –

  • toggling_repeat_context (bool) –

  • toggling_shuffle (bool) –

  • toggling_repeat_track (bool) –

  • transferring_playback (bool) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.PlayerErrorReason(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Reasons for errors in player actions.

ALREADY_PAUSED = 'The command requires playback to not be paused.'
ALREADY_PLAYING = 'The track should not be restarted if the same track and context is already playing, and there is a resume point.'
CONTEXT_DISALLOW = 'The command could not be performed on the context.'
DEVICE_NOT_CONTROLLABLE = 'Not possible to remote control the device.'
ENDLESS_CONTEXT = 'The shuffle command cannot be applied on an endless context.'
NOT_PAUSED = 'The command requires playback to be paused.'
NOT_PLAYING_CONTEXT = 'The command requires that a context is currently playing.'
NOT_PLAYING_LOCALLY = 'The command requires playback on the local device.'
NOT_PLAYING_TRACK = 'The command requires that a track is currently playing.'
NO_ACTIVE_DEVICE = 'Requires an active device and the user has none.'
NO_NEXT_TRACK = 'The command requires a next track, but there is none in the context.'
NO_PREV_TRACK = 'The command requires a previous track, but there is none in the context.'
NO_SPECIFIC_TRACK = 'The requested track does not exist.'
PREMIUM_REQUIRED = 'The request is prohibited for non-premium users.'
RATE_LIMITED = 'The user is rate limited due to too frequent track play,also known as cat-on-the-keyboard spamming.'
REMOTE_CONTROL_DISALLOW = 'The context cannot be remote-controlled.'
UNKNOWN = 'Certain actions are restricted because of unknown reasons.'
VOLUME_CONTROL_DISALLOW = "Not possible to remote control the device's volume."
class tekore.model.RepeatState(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: StrEnum

Playback repeat state.

context = 'context'
off = 'off'
track = 'track'

Play history

class tekore.model.PlayHistory(*, track, played_at, context)

Bases: Model

Previously played track.

Context is supposedly sometimes available.

Parameters:
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.PlayHistoryCursor(*, after, before)

Bases: Cursor

Cursor to play history.

Parameters:
  • after (str | None) –

  • before (str) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.PlayHistoryPaging(*, href, items, limit, next, cursors)

Bases: CursorPaging

Paging to play history.

Cursors are not available when paging is exhausted.

Parameters:
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.Context(*, type, href, external_urls, uri)

Bases: Model

Context of a played track or episode.

Parameters:
  • type (ContextType) –

  • href (str) –

  • external_urls (dict) –

  • uri (str) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.ContextType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: StrEnum

Type of player context.

album = 'album'
artist = 'artist'
collection = 'collection'
playlist = 'playlist'
show = 'show'

Playlist

Playlist

Playlist base.

PlaylistTrack

Track or episode on a playlist.

PlaylistTrackPaging

Paging of playlist tracks.

SimplePlaylist

Simplified playlist object.

SimplePlaylistPaging

Paging of simplified playlists.

FullPlaylist

Complete playlist object.

FullPlaylistTrack

Track on a playlist.

FullPlaylistEpisode

Episode on a playlist.

LocalPlaylistTrack

Local track on a playlist.

LocalItem

Base for local items.

LocalAlbum

Album of a locally saved track.

LocalArtist

Artist of a locally saved track.

LocalTrack

Locally saved track.

class tekore.model.Playlist(*, id, href, type, uri, collaborative, description, external_urls, images, name, owner, public, snapshot_id, primary_color)

Bases: Item

Playlist base.

owner can be None on featured playlists.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • collaborative (bool) –

  • description (str | None) –

  • external_urls (dict) –

  • images (list[Image] | None) –

  • name (str) –

  • owner (PublicUser) –

  • public (bool | None) –

  • snapshot_id (str) –

  • primary_color (str | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.PlaylistTrack(*, added_at, added_by, is_local, track, primary_color, video_thumbnail)

Bases: Model

Track or episode on a playlist.

Parameters:
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.PlaylistTrackPaging(*, href, items, limit, next, total, offset, previous)

Bases: OffsetPaging

Paging of playlist tracks.

Parameters:
  • href (str) –

  • items (list[PlaylistTrack]) –

  • limit (int) –

  • next (str | None) –

  • total (int) –

  • offset (int) –

  • previous (str | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.SimplePlaylist(*, id, href, type, uri, collaborative, description, external_urls, images, name, owner, public, snapshot_id, primary_color, tracks)

Bases: Playlist

Simplified playlist object.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • collaborative (bool) –

  • description (str | None) –

  • external_urls (dict) –

  • images (list[Image] | None) –

  • name (str) –

  • owner (PublicUser) –

  • public (bool | None) –

  • snapshot_id (str) –

  • primary_color (str | None) –

  • tracks (Tracks) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.SimplePlaylistPaging(*, href, items, limit, next, total, offset, previous)

Bases: OffsetPaging

Paging of simplified playlists.

Parameters:
  • href (str) –

  • items (list[SimplePlaylist | None]) –

  • limit (int) –

  • next (str | None) –

  • total (int) –

  • offset (int) –

  • previous (str | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.FullPlaylist(*, id, href, type, uri, collaborative, description, external_urls, images, name, owner, public, snapshot_id, primary_color, followers, tracks)

Bases: Playlist

Complete playlist object.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • collaborative (bool) –

  • description (str | None) –

  • external_urls (dict) –

  • images (list[Image] | None) –

  • name (str) –

  • owner (PublicUser) –

  • public (bool | None) –

  • snapshot_id (str) –

  • primary_color (str | None) –

  • followers (Followers) –

  • tracks (PlaylistTrackPaging) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.FullPlaylistTrack(*, id, href, type, uri, artists, available_markets=None, disc_number, duration_ms, explicit, external_urls, is_local, is_playable=None, linked_from=None, name, preview_url=None, restrictions=None, track_number, album, external_ids, popularity, episode, track)

Bases: FullTrack

Track on a playlist.

Provides episode and track booleans to easily determine the type of playlist item.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • artists (list[SimpleArtist]) –

  • available_markets (list[str] | None) –

  • disc_number (int) –

  • duration_ms (int) –

  • explicit (bool) –

  • external_urls (dict) –

  • is_local (Literal[False]) –

  • is_playable (bool | None) –

  • linked_from (TrackLink | None) –

  • name (str) –

  • preview_url (str | None) –

  • restrictions (Restrictions | None) –

  • track_number (int) –

  • album (SimpleAlbum) –

  • external_ids (dict) –

  • popularity (int) –

  • episode (Literal[False]) –

  • track (Literal[True]) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.FullPlaylistEpisode(*, id, href, type, uri, audio_preview_url, description, duration_ms, explicit, external_urls, html_description, images, is_externally_hosted, is_playable=None, language=None, languages, name, release_date, release_date_precision, resume_point=None, restrictions=None, show, available_markets=None, episode, track)

Bases: FullEpisode

Episode on a playlist.

Provides episode and track booleans to easily determine the type of playlist item. available_markets is undocumented.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • audio_preview_url (str | None) –

  • description (str) –

  • duration_ms (int) –

  • explicit (bool) –

  • external_urls (dict) –

  • html_description (str) –

  • images (list[Image]) –

  • is_externally_hosted (bool) –

  • is_playable (bool | None) –

  • language (str | None) –

  • languages (list[str]) –

  • name (str) –

  • release_date (str) –

  • release_date_precision (ReleaseDatePrecision) –

  • resume_point (ResumePoint | None) –

  • restrictions (Restrictions | None) –

  • show (SimpleShow) –

  • available_markets (list[str] | None) –

  • episode (Literal[True]) –

  • track (Literal[False]) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Local items

Some playlists contain locally stored tracks. They contain mostly None values along with empty lists and dictionaries.

class tekore.model.LocalPlaylistTrack(*, id, href, name, type, album, artists, available_markets=<factory>, disc_number, duration_ms, explicit, external_ids, external_urls, is_local, popularity, preview_url, track_number, uri, episode=False, track=True)

Bases: LocalTrack

Local track on a playlist.

Provides episode and track booleans to easily determine the type of playlist item.

Parameters:
  • id (None) –

  • href (None) –

  • name (str) –

  • type (str) –

  • album (LocalAlbum) –

  • artists (list[LocalArtist]) –

  • available_markets (list[None]) –

  • disc_number (int) –

  • duration_ms (int | dict) –

  • explicit (bool) –

  • external_ids (dict) –

  • external_urls (dict) –

  • is_local (Literal[True]) –

  • popularity (int) –

  • preview_url (None) –

  • track_number (int) –

  • uri (str) –

  • episode (Literal[False]) –

  • track (Literal[True]) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.LocalItem(*, id, href, name, type)

Bases: Model

Base for local items.

Parameters:
  • id (None) –

  • href (None) –

  • name (str) –

  • type (str) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.LocalAlbum(*, id, href, name, type, album_type, artists, available_markets=<factory>, external_urls, images, release_date, release_date_precision, uri)

Bases: LocalItem

Album of a locally saved track.

Parameters:
  • id (None) –

  • href (None) –

  • name (str) –

  • type (str) –

  • album_type (None) –

  • artists (list[None]) –

  • available_markets (list[None]) –

  • external_urls (dict) –

  • images (list[None]) –

  • release_date (None) –

  • release_date_precision (None) –

  • uri (None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.LocalArtist(*, id, href, name, type, external_urls, uri)

Bases: LocalItem

Artist of a locally saved track.

Parameters:
  • id (None) –

  • href (None) –

  • name (str) –

  • type (str) –

  • external_urls (dict) –

  • uri (None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.LocalTrack(*, id, href, name, type, album, artists, available_markets=<factory>, disc_number, duration_ms, explicit, external_ids, external_urls, is_local, popularity, preview_url, track_number, uri)

Bases: LocalItem

Locally saved track.

Locally saved track where most attributes are always None, empty, zero or False. duration_ms being an object is undocumented.

Parameters:
  • id (None) –

  • href (None) –

  • name (str) –

  • type (str) –

  • album (LocalAlbum) –

  • artists (list[LocalArtist]) –

  • available_markets (list[None]) –

  • disc_number (int) –

  • duration_ms (int | dict) –

  • explicit (bool) –

  • external_ids (dict) –

  • external_urls (dict) –

  • is_local (Literal[True]) –

  • popularity (int) –

  • preview_url (None) –

  • track_number (int) –

  • uri (str) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Recommendation

Recommendations

Track recommendations.

RecommendationSeed

Recommendation seeds.

RecommendationAttribute

Attributes available in recommendations.

class tekore.model.Recommendations(*, seeds, tracks)

Bases: Model

Track recommendations.

Parameters:
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.RecommendationSeed(*, id, afterFilteringSize, afterRelinkingSize, href, initialPoolSize, type)

Bases: Identifiable

Recommendation seeds.

Parameters:
  • id (str) –

  • afterFilteringSize (int) –

  • afterRelinkingSize (int) –

  • href (str | None) –

  • initialPoolSize (int) –

  • type (str) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.RecommendationAttribute(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: StrEnum

Attributes available in recommendations.

acousticness = 'acousticness'
danceability = 'danceability'
duration_ms = 'duration_ms'
energy = 'energy'
instrumentalness = 'instrumentalness'
key = 'key'
liveness = 'liveness'
loudness = 'loudness'
mode = 'mode'
popularity = 'popularity'
speechiness = 'speechiness'
tempo = 'tempo'
time_signature = 'time_signature'
valence = 'valence'

Show

Show

Show base.

SimpleShow

Simplified show object.

SimpleShowPaging

Paging of simplified shows.

FullShow

Complete show object.

SavedShow

Show saved in library.

SavedShowPaging

Paging of shows in library.

class tekore.model.Show(*, id, href, type, uri, available_markets=<factory>, copyrights, description, explicit, external_urls, html_description=None, images, is_externally_hosted, languages, media_type, name, publisher, total_episodes=None)

Bases: Item

Show base.

publisher being an object is undocumented.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • available_markets (list[str]) –

  • copyrights (list[Copyright]) –

  • description (str) –

  • explicit (bool) –

  • external_urls (dict) –

  • html_description (str | None) –

  • images (list[Image]) –

  • is_externally_hosted (bool | None) –

  • languages (list[str]) –

  • media_type (str) –

  • name (str) –

  • publisher (str | dict) –

  • total_episodes (int | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.SimpleShow(*, id, href, type, uri, available_markets=<factory>, copyrights, description, explicit, external_urls, html_description=None, images, is_externally_hosted, languages, media_type, name, publisher, total_episodes=None)

Bases: Show

Simplified show object.

total_episodes is undocumented by Spotify, so it might be missing or removed in a future version.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • available_markets (list[str]) –

  • copyrights (list[Copyright]) –

  • description (str) –

  • explicit (bool) –

  • external_urls (dict) –

  • html_description (str | None) –

  • images (list[Image]) –

  • is_externally_hosted (bool | None) –

  • languages (list[str]) –

  • media_type (str) –

  • name (str) –

  • publisher (str | dict) –

  • total_episodes (int | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.SimpleShowPaging(*, href, items, limit, next, total, offset, previous)

Bases: OffsetPaging

Paging of simplified shows.

Parameters:
  • href (str) –

  • items (list[SimpleShow]) –

  • limit (int) –

  • next (str | None) –

  • total (int) –

  • offset (int) –

  • previous (str | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.FullShow(*, id, href, type, uri, available_markets=<factory>, copyrights, description, explicit, external_urls, html_description=None, images, is_externally_hosted, languages, media_type, name, publisher, total_episodes=None, episodes=None)

Bases: Show

Complete show object.

total_episodes is undocumented by Spotify, so it might be missing or removed in a future version.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • available_markets (list[str]) –

  • copyrights (list[Copyright]) –

  • description (str) –

  • explicit (bool) –

  • external_urls (dict) –

  • html_description (str | None) –

  • images (list[Image]) –

  • is_externally_hosted (bool | None) –

  • languages (list[str]) –

  • media_type (str) –

  • name (str) –

  • publisher (str | dict) –

  • total_episodes (int | None) –

  • episodes (SimpleEpisodePaging | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.SavedShow(*, added_at, show)

Bases: Model

Show saved in library.

Parameters:
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.SavedShowPaging(*, href, items, limit, next, total, offset, previous)

Bases: OffsetPaging

Paging of shows in library.

Parameters:
  • href (str) –

  • items (list[SavedShow]) –

  • limit (int) –

  • next (str | None) –

  • total (int) –

  • offset (int) –

  • previous (str | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Track

Track

Track base.

SimpleTrack

Simplified track object.

SimpleTrackPaging

Paging of simplified tracks.

FullTrack

Complete track object.

FullTrackPaging

Paging of full tracks.

SavedTrack

Track saved to library.

SavedTrackPaging

Paging of tracks in library.

Tracks

Minimal representation of playlist tracks.

TrackLink

Relinked track.

Restrictions

Restrictions on relinked resource.

AudioAnalysis

Track audio analysis.

TimeInterval

Generic representation of an interval.

Section

Analysis of a track's section.

Segment

Analysis of a track's segment.

AudioFeatures

Features of a track.

class tekore.model.Track(*, id, href, type, uri, artists, available_markets=None, disc_number, duration_ms, explicit, external_urls, is_local, is_playable=None, linked_from=None, name, preview_url=None, restrictions=None, track_number)

Bases: Item

Track base.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • artists (list[SimpleArtist]) –

  • available_markets (list[str] | None) –

  • disc_number (int) –

  • duration_ms (int) –

  • explicit (bool) –

  • external_urls (dict) –

  • is_local (bool) –

  • is_playable (bool | None) –

  • linked_from (TrackLink | None) –

  • name (str) –

  • preview_url (str | None) –

  • restrictions (Restrictions | None) –

  • track_number (int) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.SimpleTrack(*, id, href, type, uri, artists, available_markets=None, disc_number, duration_ms, explicit, external_urls, is_local, is_playable=None, linked_from=None, name, preview_url=None, restrictions=None, track_number)

Bases: Track

Simplified track object.

When market is specified, available_markets is not available. is_playable is not available when market is not specified. restrictions is available if restrictions have been placed on the track, making it unplayable.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • artists (list[SimpleArtist]) –

  • available_markets (list[str] | None) –

  • disc_number (int) –

  • duration_ms (int) –

  • explicit (bool) –

  • external_urls (dict) –

  • is_local (bool) –

  • is_playable (bool | None) –

  • linked_from (TrackLink | None) –

  • name (str) –

  • preview_url (str | None) –

  • restrictions (Restrictions | None) –

  • track_number (int) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.SimpleTrackPaging(*, href, items, limit, next, total, offset, previous)

Bases: OffsetPaging

Paging of simplified tracks.

Parameters:
  • href (str) –

  • items (list[SimpleTrack]) –

  • limit (int) –

  • next (str | None) –

  • total (int) –

  • offset (int) –

  • previous (str | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.FullTrack(*, id, href, type, uri, artists, available_markets=None, disc_number, duration_ms, explicit, external_urls, is_local, is_playable=None, linked_from=None, name, preview_url=None, restrictions=None, track_number, album, external_ids, popularity)

Bases: Track

Complete track object.

When market is specified, available_markets is not available. is_playable is not available when market is not specified. restrictions is available if restrictions have been placed on the track, making it unplayable.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • artists (list[SimpleArtist]) –

  • available_markets (list[str] | None) –

  • disc_number (int) –

  • duration_ms (int) –

  • explicit (bool) –

  • external_urls (dict) –

  • is_local (bool) –

  • is_playable (bool | None) –

  • linked_from (TrackLink | None) –

  • name (str) –

  • preview_url (str | None) –

  • restrictions (Restrictions | None) –

  • track_number (int) –

  • album (SimpleAlbum) –

  • external_ids (dict) –

  • popularity (int) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.FullTrackPaging(*, href, items, limit, next, total, offset, previous)

Bases: OffsetPaging

Paging of full tracks.

Parameters:
  • href (str) –

  • items (list[FullTrack]) –

  • limit (int) –

  • next (str | None) –

  • total (int) –

  • offset (int) –

  • previous (str | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.SavedTrack(*, added_at, track)

Bases: Model

Track saved to library.

Parameters:
  • added_at (datetime) –

  • track (FullTrack) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.SavedTrackPaging(*, href, items, limit, next, total, offset, previous)

Bases: OffsetPaging

Paging of tracks in library.

Parameters:
  • href (str) –

  • items (list[SavedTrack]) –

  • limit (int) –

  • next (str | None) –

  • total (int) –

  • offset (int) –

  • previous (str | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.Tracks(*, href, total)

Bases: Model

Minimal representation of playlist tracks.

Parameters:
  • href (str) –

  • total (int) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Bases: Item

Relinked track.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • external_urls (dict) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.Restrictions(*, reason)

Bases: Model

Restrictions on relinked resource.

Parameters:

reason (str) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Audio analysis

class tekore.model.AudioAnalysis(*, bars, beats, sections, segments, tatums, meta, track)

Bases: Model

Track audio analysis.

See the Web API documentation for more details.

Parameters:
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.TimeInterval(*, duration, start=None, confidence=None)

Bases: Model

Generic representation of an interval.

Attributes are sometimes not available.

Parameters:
  • duration (float) –

  • start (float | None) –

  • confidence (float | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.Section(*, duration, loudness, tempo, tempo_confidence, key_confidence, mode_confidence, time_signature, time_signature_confidence, confidence=None, mode=None, key=None, start=None)

Bases: Model

Analysis of a track’s section.

Attributes are sometimes not available.

Parameters:
  • duration (float) –

  • loudness (float) –

  • tempo (float) –

  • tempo_confidence (float) –

  • key_confidence (float) –

  • mode_confidence (float) –

  • time_signature (int) –

  • time_signature_confidence (float) –

  • confidence (float | None) –

  • mode (int | None) –

  • key (int | None) –

  • start (float | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.Segment(*, duration, loudness_start, loudness_max, pitches, timbre, confidence=None, loudness_end=None, loudness_max_time=None, start=None)

Bases: Model

Analysis of a track’s segment.

Attributes are sometimes not available.

Parameters:
  • duration (float) –

  • loudness_start (float) –

  • loudness_max (float) –

  • pitches (list[float]) –

  • timbre (list[float]) –

  • confidence (float | None) –

  • loudness_end (float | None) –

  • loudness_max_time (float | None) –

  • start (float | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Audio features

class tekore.model.AudioFeatures(*, id, acousticness, analysis_url, danceability, duration_ms, energy, instrumentalness, key, liveness, loudness, mode, speechiness, tempo, time_signature, track_href, type, uri, valence)

Bases: Identifiable

Features of a track.

Parameters:
  • id (str) –

  • acousticness (float) –

  • analysis_url (str) –

  • danceability (float) –

  • duration_ms (int) –

  • energy (float) –

  • instrumentalness (float) –

  • key (int) –

  • liveness (float) –

  • loudness (float) –

  • mode (int) –

  • speechiness (float) –

  • tempo (float) –

  • time_signature (int) –

  • track_href (str) –

  • type (str) –

  • uri (str) –

  • valence (float) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

User

User

User base.

PublicUser

User as viewable by anyone.

PrivateUser

User with private information.

ExplicitContent

Explicit content filter of a user.

class tekore.model.User(*, id, href, type, uri, external_urls, display_name=None, followers=None, images=None)

Bases: Item

User base.

display_name, followers and images may not be available.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • external_urls (dict) –

  • display_name (str | None) –

  • followers (Followers | None) –

  • images (list[Image] | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.PublicUser(*, id, href, type, uri, external_urls, display_name=None, followers=None, images=None)

Bases: User

User as viewable by anyone.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • external_urls (dict) –

  • display_name (str | None) –

  • followers (Followers | None) –

  • images (list[Image] | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.PrivateUser(*, id, href, type, uri, external_urls, display_name=None, followers=None, images=None, country=None, email=None, explicit_content=None, product=None, birthday=None)

Bases: User

User with private information.

country, explicit_content and product require the user-read-private scope. email requires the user-read-email scope. birthday is unavailable unless the now-invalid user-read-birthdate scope was granted to the token.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

  • external_urls (dict) –

  • display_name (str | None) –

  • followers (Followers | None) –

  • images (list[Image] | None) –

  • country (str | None) –

  • email (str | None) –

  • explicit_content (ExplicitContent | None) –

  • product (str | None) –

  • birthday (str | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.ExplicitContent(*, filter_enabled, filter_locked)

Bases: Model

Explicit content filter of a user.

Parameters:
  • filter_enabled (bool) –

  • filter_locked (bool) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Miscellaneous

Copyright

Copyright.

Followers

Followers.

Image

Image link and information.

ReleaseDatePrecision

Precision of a release date.

class tekore.model.Copyright(*, text, type)

Bases: Model

Copyright.

Parameters:
  • text (str) –

  • type (str) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.Followers(*, href, total)

Bases: Model

Followers.

href is always None.

Parameters:
  • href (None) –

  • total (int) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.Image(*, url, height, width)

Bases: Model

Image link and information.

The Web API documentation reports that height and width can be None or not available in the response.

Parameters:
  • url (str) –

  • height (int | None) –

  • width (int | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.ReleaseDatePrecision(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: StrEnum

Precision of a release date.

day = 'day'
minute = 'minute'
month = 'month'
year = 'year'

Model bases

Model

Response model base.

UnknownModelAttributeWarning

The response model contains an unknown attribute.

Identifiable

Object identified with a Spotify ID.

Item

Identifiable with additional fields.

Paging

Paging base.

OffsetPaging

Offset paging base.

Cursor

Data cursor.

CursorPaging

Cursor paging base.

Functionality

class tekore.model.Model

Bases: BaseModel

Response model base.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.UnknownModelAttributeWarning

Bases: RuntimeWarning

The response model contains an unknown attribute.

Models

class tekore.model.Identifiable(*, id)

Bases: Model

Object identified with a Spotify ID.

Parameters:

id (str) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.Item(*, id, href, type, uri)

Bases: Identifiable

Identifiable with additional fields.

Parameters:
  • id (str) –

  • href (str) –

  • type (str) –

  • uri (str) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.Paging(*, href, items, limit, next)

Bases: Model

Paging base.

Parameters:
  • href (str) –

  • items (Sequence[Model | None]) –

  • limit (int) –

  • next (str | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.OffsetPaging(*, href, items, limit, next, total, offset, previous)

Bases: Paging

Offset paging base.

Paging that can be navigated both forward and back.

Parameters:
  • href (str) –

  • items (Sequence[Model | None]) –

  • limit (int) –

  • next (str | None) –

  • total (int) –

  • offset (int) –

  • previous (str | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.Cursor(*, after)

Bases: Model

Data cursor.

Parameters:

after (str | None) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tekore.model.CursorPaging(*, href, items, limit, next, cursors)

Bases: Paging

Cursor paging base.

Paging that can be navigated only forward following the cursor.

Parameters:
  • href (str) –

  • items (Sequence[Model | None]) –

  • limit (int) –

  • next (str | None) –

  • cursors (Cursor) –

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Member types

class tekore.model.StrEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: str, Enum

Convert enumeration members to strings using their name.

Ignores case when getting items. This does not change values.