1
0
Fork 0
mirror of https://github.com/sileht/bird-lg.git synced 2024-11-21 22:44:43 +01:00

Catch possible exceptions thrown by the ASN DNS resolver

This commit is contained in:
Baptiste Jonglez 2014-01-28 15:45:03 +01:00
parent 2418d13d07
commit e557dd651b

5
lg.py
View file

@ -48,7 +48,10 @@ app.logger.addHandler(file_handler)
def get_asn_from_as(n):
asn_zone = app.config.get("ASN_ZONE", "asn.cymru.com")
data = resolve("AS%s.%s" % (n, asn_zone) ,"TXT").replace("'","").replace('"','')
try:
data = resolve("AS%s.%s" % (n, asn_zone) ,"TXT").replace("'","").replace('"','')
except:
return " "*5
return [ field.strip() for field in data.split("|") ]