Merge remote-tracking branch 'origin/master'

# Conflicts:
#	common/ipasn.py
This commit is contained in:
Jing Ling
2020-07-23 14:16:18 +08:00
2 changed files with 136 additions and 4 deletions
+4 -4
View File
@@ -14,8 +14,8 @@ class Entry(object):
class IPAsnData(object):
def __init__(self):
zip_path = data_storage_dir.joinpath("IP2LOCATION-LITE-ASN.CSV.ZIP")
csv_path = data_storage_dir.joinpath("IP2LOCATION-LITE-ASN.CSV")
zip_path = data_storage_dir.joinpath('IP2LOCATION-LITE-ASN.CSV.ZIP')
csv_path = data_storage_dir.joinpath('IP2LOCATION-LITE-ASN.CSV')
if csv_path.exists():
asn_fp = open(csv_path)
else:
@@ -63,10 +63,10 @@ class IPAsnInfo(object):
def find(self, ip):
asn = self.asn.find(ip)
if asn:
result = {"cidr": asn[2], "asn": f'AS{asn[3]} {asn[4]}'}
result = {'cidr': asn[2], 'asn': f'AS{asn[3]} {asn[4]}'}
return result
else:
return {"cidr": "", "asn": ""}
return {'cidr': '', 'asn': ''}
if __name__ == "__main__":