spotifywebapipython.models.playhistory

@export
class PlayHistory:

Spotify Web API PlayHistory object.

PlayHistory(root: dict = None)

Initializes a new instance of the class.

Arguments:
  • root (dict): Spotify Web API JSON response in dictionary format, used to load object attributes; otherwise, None to not load attributes.
PlayedAt: str

The date and time the track was played (in local time).

Example: 2024-01-25T15:33:17.136Z

PlayedAtMS: int

The PlayedAt value in Unix millisecond timestamp format, or null if the PlayedAt value is null.

Example: 1706213826000

The context the track was played from.

The track the user listened to.

def ToDictionary(self) -> dict:

Returns a dictionary representation of the class.

def ToString(self, includeItems: bool = False) -> str:

Returns a displayable string representation of the class.

Arguments:
  • includeItems (bool): True to include the Items collection of objects; otherwise, False to only return base properties.