Catch possible exceptions thrown by the ASN DNS resolver
This commit is contained in:
parent
2418d13d07
commit
e557dd651b
3
lg.py
3
lg.py
@ -48,7 +48,10 @@ app.logger.addHandler(file_handler)
|
|||||||
|
|
||||||
def get_asn_from_as(n):
|
def get_asn_from_as(n):
|
||||||
asn_zone = app.config.get("ASN_ZONE", "asn.cymru.com")
|
asn_zone = app.config.get("ASN_ZONE", "asn.cymru.com")
|
||||||
|
try:
|
||||||
data = resolve("AS%s.%s" % (n, asn_zone) ,"TXT").replace("'","").replace('"','')
|
data = resolve("AS%s.%s" % (n, asn_zone) ,"TXT").replace("'","").replace('"','')
|
||||||
|
except:
|
||||||
|
return " "*5
|
||||||
return [ field.strip() for field in data.split("|") ]
|
return [ field.strip() for field in data.split("|") ]
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user