so I am doing a project using Spotipy for it:
===========CODE=================
#Import liabrary import spotipy; import pandas as pd; import numpy as py; from spotipy.oauth2 import SpotifyOAuth #set up spotipy sp = spotipy.Spotify(auth_manager=SpotifyOAuth(client_id= "----", client_secret="----", redirect_uri="----")) #Assign Variables df = pd.read_excel(r"adress") df= df[0:5] artist= df['Artist Names'] track= df['Song Title'] track_ids_dict={} track_ids = [] #Body #---finding the track ids of songs from their name and artist names for a,b in zip(artist,track): #print(a,b) try: track_id = sp.search(q='artist:' + a + ' track:' + b, type='track') track_id = track_id['tracks']['items'][0]['id'] #print(track_id) track_ids_dict[b+' from '+a]=track_id track_ids.append(track_id) except: #print("FAIL",a,"",b) track_ids_dict[b+' FROM '+a]="FAIL!!!" track_ids.append(b+a+" FAIL") print(track_ids) for i in track_ids: try: audio_features = sp.audio_analysis(i) print(i) except: print("fail")
====================Expected result===================
[list of track ids]
{features of songs}
===================Actual result=================
HTTP Error for GET to https://api.spotify.com/v1/audio-analysis/0mHGftgYtmpH4y17T3VZ2E with Params: {} returned 403 due to None HTTP Error for GET to https://api.spotify.com/v1/audio-analysis/1lOYVplYufO4jaclx68H2L with Params: {} returned 403 due to None ['0mHGftgYtmpH4y17T3VZ2E', '1lOYVplYufO4jaclx68H2L', '6fqaMyg066xlukvUJWdM2T', '2hJf188Sz3XxfBDmYK1IMC', '64yrDBpcdwEdNY9loyEGbX'] fail fail HTTP Error for GET to https://api.spotify.com/v1/audio-analysis/6fqaMyg066xlukvUJWdM2T with Params: {} returned 403 due to None HTTP Error for GET to https://api.spotify.com/v1/audio-analysis/2hJf188Sz3XxfBDmYK1IMC with Params: {} returned 403 due to None HTTP Error for GET to https://api.spotify.com/v1/audio-analysis/64yrDBpcdwEdNY9loyEGbX with Params: {} returned 403 due to None fail fail
submitted by /u/Nepoleon_bone_apart
[link] [comments]
r/learnpython so I am doing a project using Spotipy for it: ===========CODE================= #Import liabrary import spotipy; import pandas as pd; import numpy as py; from spotipy.oauth2 import SpotifyOAuth #set up spotipy sp = spotipy.Spotify(auth_manager=SpotifyOAuth(client_id= “—-“, client_secret=”—-“, redirect_uri=”—-“)) #Assign Variables df = pd.read_excel(r”adress”) df= df[0:5] artist= df[‘Artist Names’] track= df[‘Song Title’] track_ids_dict={} track_ids = [] #Body #—finding the track ids of songs from their name and artist names for a,b in zip(artist,track): #print(a,b) try: track_id = sp.search(q=’artist:’ + a + ‘ track:’ + b, type=’track’) track_id = track_id[‘tracks’][‘items’][0][‘id’] #print(track_id) track_ids_dict[b+’ from ‘+a]=track_id track_ids.append(track_id) except: #print(“FAIL”,a,””,b) track_ids_dict[b+’ FROM ‘+a]=”FAIL!!!” track_ids.append(b+a+” FAIL”) print(track_ids) for i in track_ids: try: audio_features = sp.audio_analysis(i) print(i) except: print(“fail”) ====================Expected result=================== [list of track ids] {features of songs} ===================Actual result================= HTTP Error for GET to https://api.spotify.com/v1/audio-analysis/0mHGftgYtmpH4y17T3VZ2E with Params: {} returned 403 due to None HTTP Error for GET to https://api.spotify.com/v1/audio-analysis/1lOYVplYufO4jaclx68H2L with Params: {} returned 403 due to None [‘0mHGftgYtmpH4y17T3VZ2E’, ‘1lOYVplYufO4jaclx68H2L’, ‘6fqaMyg066xlukvUJWdM2T’, ‘2hJf188Sz3XxfBDmYK1IMC’, ’64yrDBpcdwEdNY9loyEGbX’] fail fail HTTP Error for GET to https://api.spotify.com/v1/audio-analysis/6fqaMyg066xlukvUJWdM2T with Params: {} returned 403 due to None HTTP Error for GET to https://api.spotify.com/v1/audio-analysis/2hJf188Sz3XxfBDmYK1IMC with Params: {} returned 403 due to None HTTP Error for GET to https://api.spotify.com/v1/audio-analysis/64yrDBpcdwEdNY9loyEGbX with Params: {} returned 403 due to None fail fail submitted by /u/Nepoleon_bone_apart [link] [comments]
so I am doing a project using Spotipy for it:
===========CODE=================
#Import liabrary import spotipy; import pandas as pd; import numpy as py; from spotipy.oauth2 import SpotifyOAuth #set up spotipy sp = spotipy.Spotify(auth_manager=SpotifyOAuth(client_id= "----", client_secret="----", redirect_uri="----")) #Assign Variables df = pd.read_excel(r"adress") df= df[0:5] artist= df['Artist Names'] track= df['Song Title'] track_ids_dict={} track_ids = [] #Body #---finding the track ids of songs from their name and artist names for a,b in zip(artist,track): #print(a,b) try: track_id = sp.search(q='artist:' + a + ' track:' + b, type='track') track_id = track_id['tracks']['items'][0]['id'] #print(track_id) track_ids_dict[b+' from '+a]=track_id track_ids.append(track_id) except: #print("FAIL",a,"",b) track_ids_dict[b+' FROM '+a]="FAIL!!!" track_ids.append(b+a+" FAIL") print(track_ids) for i in track_ids: try: audio_features = sp.audio_analysis(i) print(i) except: print("fail")
====================Expected result===================
[list of track ids]
{features of songs}
===================Actual result=================
HTTP Error for GET to https://api.spotify.com/v1/audio-analysis/0mHGftgYtmpH4y17T3VZ2E with Params: {} returned 403 due to None HTTP Error for GET to https://api.spotify.com/v1/audio-analysis/1lOYVplYufO4jaclx68H2L with Params: {} returned 403 due to None ['0mHGftgYtmpH4y17T3VZ2E', '1lOYVplYufO4jaclx68H2L', '6fqaMyg066xlukvUJWdM2T', '2hJf188Sz3XxfBDmYK1IMC', '64yrDBpcdwEdNY9loyEGbX'] fail fail HTTP Error for GET to https://api.spotify.com/v1/audio-analysis/6fqaMyg066xlukvUJWdM2T with Params: {} returned 403 due to None HTTP Error for GET to https://api.spotify.com/v1/audio-analysis/2hJf188Sz3XxfBDmYK1IMC with Params: {} returned 403 due to None HTTP Error for GET to https://api.spotify.com/v1/audio-analysis/64yrDBpcdwEdNY9loyEGbX with Params: {} returned 403 due to None fail fail
submitted by /u/Nepoleon_bone_apart
[link] [comments]