i am currently working on getting some track infos from last fm by using their api. I am using the request library by requesting track infos based on artist and track name, i specify the user to know the times they listened to it. I call it like the following
ric = 'http://ws.audioscrobbler.com/2.0/?method=track.getInfo&api_key=API_KEY&artist=Tomasz%20Stanko&track=Love%20Theme%20From%20Forewell%20To%20Maria&username=miner&autocorrect=1&format=json'
r = req.get(ric)
if (r.status_code == 200):
d = r.json()
else:
d = dict()
i made sure that the request got the response by checking the status code, but, if the track is not found, it still responds with code 200, and the answer looks like this.
{"error":6,"message":"Track not found","links":[]}
Since i need to use the track infos to export them in a json file, i would like to know if you can suggest me a way to ensure that the track is actually found. Thanks to anybody who bothered to read till now.