Spotify deprecated several endpoints in Nov, 2024. Two of them were being used in Tracks tools. We're removing those from the Toolkit. Spotify announcement: https://developer.spotify.com/blog/2024-11-27-changes-to-the-web-api Archive: https://archive.is/LMBe5
22 lines
618 B
Python
22 lines
618 B
Python
from typing import Annotated
|
|
|
|
from arcade.sdk import ToolContext, tool
|
|
from arcade.sdk.auth import Spotify
|
|
|
|
from arcade_spotify.tools.utils import (
|
|
get_url,
|
|
send_spotify_request,
|
|
)
|
|
|
|
|
|
@tool(requires_auth=Spotify())
|
|
async def get_track_from_id(
|
|
context: ToolContext,
|
|
track_id: Annotated[str, "The Spotify ID of the track"],
|
|
) -> Annotated[dict, "Information about the track"]:
|
|
"""Get information about a track"""
|
|
url = get_url("tracks_get_track", track_id=track_id)
|
|
|
|
response = await send_spotify_request(context, "GET", url)
|
|
response.raise_for_status()
|
|
return dict(response.json())
|