Sample sheet: https://app.quadratichq.com/file/599e0fa8-3f4c-401b-b917-6615ade9514f
Authentication
To get started with the Spotify API make sure you've set up your developer account correctly: [https://developer.spotify.com/dashboard/create](https://developer.spotify.com/dashboard/create). From here you can retrieve your client_id and client_secret. You'll need these to make any requests.We'll use Spotipy, a lightweight Python library for the Spotify Web API.
Making requests
Get popular tracks for an artist
# install and import Spotipy and required SSL library
import micropip
await micropip.install('spotipy')
await micropip.install('ssl')
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials
# Create a Spotipy instance using your credentials from: https://developer.spotify.com/dashboard
sp = spotipy.Spotify(auth_manager=SpotifyClientCredentials(client_id="<your_client_id>",
client_secret="<your_client_secret>"))
# Perform your query
artist = c(1,2)
results = sp.search(q=artist, limit=40)
track_list = []
for idx, track in enumerate(results['tracks']['items']):
track_list.append(track['name'])
# Return the track list to the sheet
track_list
Need help making this connection? Feel free to reach out to support@quadratichq.com for help.