I'm trying to get the malicious value from a JSON string.
What's a straight forward way of getting this value? Screenshot and code below.
Pastebin: link
Screenshot:
import json
def vt(domain):
# load json content from file
with open('vt.txt', 'r') as file:
content = file.read()
# convert from sring to json
content = json.loads(content)
# read how many engines detect this domain as malicious
malicious = content["data"]["attributes"]["last_analysis_stats"]["malicious"]
vt("pp-alert.com")
Repl.it code: https://repl.it/@MiguelDuarte1/ButteryCanineDonateware

[0]incontent["data"]["attributes"][0]["malicious"]? I don't see any list in your JSON file. You have to access the correct dictionary key.["last_analysis_stats"]