Tracks
Module with the albums endpoint
Track (Endpoint)
¶
Track endpoint
Source code in async_spotify/api/_endpoints/tracks.py
class Track(Endpoint):
"""
Track endpoint
"""
async def audio_analyze(self, track_id: str, auth_token: SpotifyAuthorisationToken = None) -> dict:
"""
Get a detailed audio analysis for a single track identified by its unique Spotify ID.
Notes:
[https://developer.spotify.com/documentation/web-api/reference/tracks/get-audio-analysis/](https://developer.spotify.com/documentation/web-api/reference/tracks/get-audio-analysis/)
Args:
track_id: The spotify track id
auth_token: The auth token if you set the api class not to keep the token in memory
Returns:
Detailed audio analysis for a single track
"""
url, _ = self._add_url_params(URLS.TRACKS.ANALYZE, {'id': track_id})
return await self.api_request_handler.make_request('GET', url, {}, auth_token)
async def audio_features(self, track_id: str, auth_token: SpotifyAuthorisationToken = None) -> dict:
"""
Get audio feature information for a single track identified by its unique Spotify ID.
Notes:
[https://developer.spotify.com/documentation/web-api/reference/tracks/get-audio-features/](https://developer.spotify.com/documentation/web-api/reference/tracks/get-audio-features/)
Args:
track_id: The spotify track id
auth_token: The auth token if you set the api class not to keep the token in memory
Returns:
Audio feature information for a single track
"""
url, _ = self._add_url_params(URLS.TRACKS.FEATURES, {'id': track_id})
return await self.api_request_handler.make_request('GET', url, {}, auth_token)
async def several_audio_features(self, track_id_list: List[str],
auth_token: SpotifyAuthorisationToken = None) -> dict:
"""
Get audio features for multiple tracks based on their Spotify IDs.
Notes:
[https://developer.spotify.com/documentation/web-api/reference/tracks/get-several-audio-features/](https://developer.spotify.com/documentation/web-api/reference/tracks/get-several-audio-features/)
Args:
track_id_list: A list of spotify ids
auth_token: The auth token if you set the api class not to keep the token in memory
Returns:
Audio feature information for several track
"""
return await self.api_request_handler.make_request(
'GET', URLS.TRACKS.MULTI_FEATURES, {'ids': track_id_list}, auth_token)
async def get_several(self, track_id_list: List[str], auth_token: SpotifyAuthorisationToken = None, **kwargs) -> dict:
"""
Get Spotify catalog information for multiple tracks based on their Spotify IDs.
Notes:
[https://developer.spotify.com/documentation/web-api/reference/tracks/get-several-tracks/}(https://developer.spotify.com/documentation/web-api/reference/tracks/get-several-tracks/)
Args:
track_id_list: A list of spotify ids
auth_token: The auth token if you set the api class not to keep the token in memory
kwargs: Optional arguments as keyword args
Returns:
Information about several tracks
"""
return await self.api_request_handler.make_request(
'GET', URLS.TRACKS.SEVERAL, {**{'ids': track_id_list}, **kwargs}, auth_token)
async def get_one(self, track_id: str, auth_token: SpotifyAuthorisationToken = None, **kwargs) -> dict:
"""
Get Spotify catalog information for a single track identified by its unique Spotify ID.
Notes:
[https://developer.spotify.com/documentation/web-api/reference/tracks/get-track/](https://developer.spotify.com/documentation/web-api/reference/tracks/get-track/)
Args:
track_id: The spotify track id
auth_token: The auth token if you set the api class not to keep the token in memory
kwargs: Optional arguments as keyword args
Returns:
Information about one track
"""
url, _ = self._add_url_params(URLS.TRACKS.ONE, {'id': track_id})
return await self.api_request_handler.make_request(
'GET', url, kwargs, auth_token)
audio_analyze(self, track_id, auth_token=None)
async
¶
Get a detailed audio analysis for a single track identified by its unique Spotify ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
track_id |
str |
The spotify track id |
required |
auth_token |
SpotifyAuthorisationToken |
The auth token if you set the api class not to keep the token in memory |
None |
Returns:
Type | Description |
---|---|
dict |
Detailed audio analysis for a single track |
Source code in async_spotify/api/_endpoints/tracks.py
async def audio_analyze(self, track_id: str, auth_token: SpotifyAuthorisationToken = None) -> dict:
"""
Get a detailed audio analysis for a single track identified by its unique Spotify ID.
Notes:
[https://developer.spotify.com/documentation/web-api/reference/tracks/get-audio-analysis/](https://developer.spotify.com/documentation/web-api/reference/tracks/get-audio-analysis/)
Args:
track_id: The spotify track id
auth_token: The auth token if you set the api class not to keep the token in memory
Returns:
Detailed audio analysis for a single track
"""
url, _ = self._add_url_params(URLS.TRACKS.ANALYZE, {'id': track_id})
return await self.api_request_handler.make_request('GET', url, {}, auth_token)
audio_features(self, track_id, auth_token=None)
async
¶
Get audio feature information for a single track identified by its unique Spotify ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
track_id |
str |
The spotify track id |
required |
auth_token |
SpotifyAuthorisationToken |
The auth token if you set the api class not to keep the token in memory |
None |
Returns:
Type | Description |
---|---|
dict |
Audio feature information for a single track |
Source code in async_spotify/api/_endpoints/tracks.py
async def audio_features(self, track_id: str, auth_token: SpotifyAuthorisationToken = None) -> dict:
"""
Get audio feature information for a single track identified by its unique Spotify ID.
Notes:
[https://developer.spotify.com/documentation/web-api/reference/tracks/get-audio-features/](https://developer.spotify.com/documentation/web-api/reference/tracks/get-audio-features/)
Args:
track_id: The spotify track id
auth_token: The auth token if you set the api class not to keep the token in memory
Returns:
Audio feature information for a single track
"""
url, _ = self._add_url_params(URLS.TRACKS.FEATURES, {'id': track_id})
return await self.api_request_handler.make_request('GET', url, {}, auth_token)
get_one(self, track_id, auth_token=None, **kwargs)
async
¶
Get Spotify catalog information for a single track identified by its unique Spotify ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
track_id |
str |
The spotify track id |
required |
auth_token |
SpotifyAuthorisationToken |
The auth token if you set the api class not to keep the token in memory |
None |
kwargs |
Optional arguments as keyword args |
{} |
Returns:
Type | Description |
---|---|
dict |
Information about one track |
Source code in async_spotify/api/_endpoints/tracks.py
async def get_one(self, track_id: str, auth_token: SpotifyAuthorisationToken = None, **kwargs) -> dict:
"""
Get Spotify catalog information for a single track identified by its unique Spotify ID.
Notes:
[https://developer.spotify.com/documentation/web-api/reference/tracks/get-track/](https://developer.spotify.com/documentation/web-api/reference/tracks/get-track/)
Args:
track_id: The spotify track id
auth_token: The auth token if you set the api class not to keep the token in memory
kwargs: Optional arguments as keyword args
Returns:
Information about one track
"""
url, _ = self._add_url_params(URLS.TRACKS.ONE, {'id': track_id})
return await self.api_request_handler.make_request(
'GET', url, kwargs, auth_token)
get_several(self, track_id_list, auth_token=None, **kwargs)
async
¶
Get Spotify catalog information for multiple tracks based on their Spotify IDs.
Notes
[https://developer.spotify.com/documentation/web-api/reference/tracks/get-several-tracks/}(https://developer.spotify.com/documentation/web-api/reference/tracks/get-several-tracks/)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
track_id_list |
List[str] |
A list of spotify ids |
required |
auth_token |
SpotifyAuthorisationToken |
The auth token if you set the api class not to keep the token in memory |
None |
kwargs |
Optional arguments as keyword args |
{} |
Returns:
Type | Description |
---|---|
dict |
Information about several tracks |
Source code in async_spotify/api/_endpoints/tracks.py
async def get_several(self, track_id_list: List[str], auth_token: SpotifyAuthorisationToken = None, **kwargs) -> dict:
"""
Get Spotify catalog information for multiple tracks based on their Spotify IDs.
Notes:
[https://developer.spotify.com/documentation/web-api/reference/tracks/get-several-tracks/}(https://developer.spotify.com/documentation/web-api/reference/tracks/get-several-tracks/)
Args:
track_id_list: A list of spotify ids
auth_token: The auth token if you set the api class not to keep the token in memory
kwargs: Optional arguments as keyword args
Returns:
Information about several tracks
"""
return await self.api_request_handler.make_request(
'GET', URLS.TRACKS.SEVERAL, {**{'ids': track_id_list}, **kwargs}, auth_token)
several_audio_features(self, track_id_list, auth_token=None)
async
¶
Get audio features for multiple tracks based on their Spotify IDs.
Notes
https://developer.spotify.com/documentation/web-api/reference/tracks/get-several-audio-features/
Parameters:
Name | Type | Description | Default |
---|---|---|---|
track_id_list |
List[str] |
A list of spotify ids |
required |
auth_token |
SpotifyAuthorisationToken |
The auth token if you set the api class not to keep the token in memory |
None |
Returns:
Type | Description |
---|---|
dict |
Audio feature information for several track |
Source code in async_spotify/api/_endpoints/tracks.py
async def several_audio_features(self, track_id_list: List[str],
auth_token: SpotifyAuthorisationToken = None) -> dict:
"""
Get audio features for multiple tracks based on their Spotify IDs.
Notes:
[https://developer.spotify.com/documentation/web-api/reference/tracks/get-several-audio-features/](https://developer.spotify.com/documentation/web-api/reference/tracks/get-several-audio-features/)
Args:
track_id_list: A list of spotify ids
auth_token: The auth token if you set the api class not to keep the token in memory
Returns:
Audio feature information for several track
"""
return await self.api_request_handler.make_request(
'GET', URLS.TRACKS.MULTI_FEATURES, {'ids': track_id_list}, auth_token)