mirror of
https://github.com/sileht/bird-lg.git
synced 2024-11-25 16:24:43 +01:00
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):
|
||||
asn_zone = app.config.get("ASN_ZONE", "asn.cymru.com")
|
||||
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