I have just made a program to parse some data from an api.
The api gives data back with a JSON format. When I try to parse it it gives me a key error
Traceback (most recent call last):
File "test.py", line 20, in
print(parsed_json['plain'])
KeyError: 'plain'
This is the part of the code that matters (the rest is just for making the url, works perfectly fine)
response = urllib.request.urlopen(url2).read()
strr = str(response)
if "plain" in strr:
parsed_json = json.loads(response.decode("UTF-8"))
print(parsed_json['plain'])
elif "INVALID HASH" in strr:
print("You have entered an invalid hash.")
elif "NOT FOUND" in strr:
print("The hash is not found")
elif "LIMIT REACHED&#