I need to take only one value from an XML/JSON file I read into a value. https://whoisapi.whoisxmlapi.com/whois/google.com?format=XML
here is my code example :
import json
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
domainName = 'google.com';
apiKey = 'YourApiKey'
url = 'https://www.whoisxmlapi.com/whoisserver/WhoisService?'\
+ 'domainName=' + domainName + '&apiKey=' + apiKey + "&outputFormat=JSON"
testing=urlopen(url).read().decode('utf8')
test = json.loads(whoisdb)
registrar = test['WhoisRecord']['registrarName']
domain['whois-created'] = test['WhoisRecord']['createdDate']
And if I am using the value "registrar" later, I get a "Keyerror".
Unfortunaly neither of the other Questions helped me...
Edit : https://i.stack.imgur.com/FMBjW.png ,well he gets the value in the variable, but I still get this error.(I printed the error while running)