Are there any method in requests
to search the track using the artist name?
Using Spotify library I used to search:
sp.search(q=f'artist:{search_artist}', type='artist', limit=limit)
My Code:
import requests
client_id = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
client_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'
auth_url = 'https://accounts.spotify.com/api/token'
data = {
'grant_type': 'client_credentials',
'client_id': client_id,
'client_secret': client_secret,
}
auth_response = requests.post(auth_url, data=data)
access_token = auth_response.json().get('access_token')
print(access_token)
base_url = 'https://api.spotify.com/v1/search'
headers = {
'Authorization': 'Bearer {}'.format(access_token)
}
artist_name = "John"
You can query this format
More detail in here
Demo code
Result