Fix missing country in whois lookup causing error

This commit is contained in:
JonnyWong16 2018-03-02 15:39:05 -08:00
parent 66167d5960
commit 9d08717c83

View file

@ -646,7 +646,7 @@ def whois_lookup(ip_address):
countries = ipwhois.utils.get_countries()
nets = whois['nets']
for net in nets:
net['country'] = countries[net['country']]
net['country'] = countries.get(net['country'])
if net['postal_code']:
net['postal_code'] = net['postal_code'].replace('-', ' ')
except ValueError as e: