mirror of
https://github.com/sileht/bird-lg.git
synced 2024-11-22 06:54:43 +01:00
Catch 'ASName' in whois answer
This commit is contained in:
parent
1a105698c5
commit
105d5f16ac
4
lg.py
4
lg.py
|
@ -262,9 +262,9 @@ ASNAME_CACHE = load_cache_pickle(ASNAME_CACHE_FILE, {})
|
||||||
def get_as_name(_as):
|
def get_as_name(_as):
|
||||||
if not ASNAME_CACHE.has_key(_as):
|
if not ASNAME_CACHE.has_key(_as):
|
||||||
whois_answer = whois_command("as%s" % _as)
|
whois_answer = whois_command("as%s" % _as)
|
||||||
as_name = re.search('as-name: (.*)', whois_answer)
|
as_name = re.search('(as-name|ASName): (.*)', whois_answer)
|
||||||
if as_name:
|
if as_name:
|
||||||
ASNAME_CACHE[_as] = as_name.group(1).strip()
|
ASNAME_CACHE[_as] = as_name.group(2).strip()
|
||||||
else:
|
else:
|
||||||
ASNAME_CACHE[_as] = _as
|
ASNAME_CACHE[_as] = _as
|
||||||
save_cache_pickle(ASNAME_CACHE_FILE, ASNAME_CACHE)
|
save_cache_pickle(ASNAME_CACHE_FILE, ASNAME_CACHE)
|
||||||
|
|
Loading…
Reference in a new issue