Python Forum
Get Spotify Artist URI (Python beginner)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get Spotify Artist URI (Python beginner)
#1
Hi everyone, I am working on a final project for my master's program. Confused

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. Sad
Is there anyone that might be able to help this Python dummy out? Huh

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)
Larz60+ write Nov-18-2020, 04:09 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.

Fixed for you this time. Please use bbcode tags on future posts.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Find how many times a user played an artist and how many times disruptfwd8 1 2,576 May-04-2018, 08:32 AM
Last Post: killerrex

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020