Nov-18-2020, 10:39 AM
Hi everyone, I am working on a final project for my master's program.
One of the tasks is to get the Spotify artist URI of each artist(name), listed in a different dataset ('data'). And afterwards I have to add the URI of each artist to the original dataset.
I have been trying something, but I keep getting error messages.
Is there anyone that might be able to help this Python dummy out?
This is my code:

One of the tasks is to get the Spotify artist URI of each artist(name), listed in a different dataset ('data'). And afterwards I have to add the URI of each artist to the original dataset.
I have been trying something, but I keep getting error messages.

Is there anyone that might be able to help this Python dummy out?

This is my code:
import requests import json # Setting headers headers = { 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': 'Bearer BQDXxeeEiSPLfjhRS_IclrK5HsvL7-VD-EGWGQXUTzGw4DZjGPJKfvnAENy9hAtGplHgW7yngchunypC_1EV_b2CKz_qW6AOoh9fp0yG0ckyCArxAGSqa8aMzW4BHeLiBbD8L7HObUS7zX_XK-PGAvrQF_sUFMpIgpMtcsRi', } for name in data: response = requests.get(' https://api.spotify.com/v1/artists/{id}', headers=headers) # Making request json_data = json.loads(response.text) # Converting response into Python data structure print(json_data)