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:
parent
2418d13d07
commit
e557dd651b
5
lg.py
5
lg.py
|
@ -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("|") ]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue