The error means: There is no key "mbid" in track_data.
You can not trust data from the internet.
You have to check each key for existence.
Sample:
You can not trust data from the internet.
You have to check each key for existence.
Sample:
#!/usr/bin/python3 dd = { "a": "aa" } print(dd["a"]) print(dd["x"]) # <== KeyError 'x'