Skip to content

Commit f37c83e

Browse files
committed
1.5.0
1 parent 9586575 commit f37c83e

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

ipdb/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
from .base_station import BaseStation
1010
from .exceptions import IPNotFound
1111
from .exceptions import DatabaseError
12+
from .asn import ASNInfo

ipdb/city.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
from .database import Reader
77
from .district import DistrictInfo
8+
from .asn import ASNInfo
9+
810
import json
911

1012
class CityInfo:
@@ -29,7 +31,11 @@ class CityInfo:
2931
currency_name = ""
3032
anycast = ""
3133
line = ""
34+
usage_type = ""
3235
district_info = ""
36+
route = ""
37+
asn = ""
38+
asn_info = ""
3339

3440
def __init__(self, **kwargs):
3541
self._map = kwargs
@@ -45,6 +51,16 @@ def get_district(self):
4551
o["city_name"] = self.city_name
4652
return DistrictInfo(**o)
4753

54+
def get_asninfo(self):
55+
if len(self.asn_info) == 0:
56+
return None
57+
ls = json.loads(self.asn_info)
58+
result = []
59+
for i in ls:
60+
result.append(ASNInfo(**i))
61+
62+
return result
63+
4864

4965
class City:
5066

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
setup(
66
name='ipip-ipdb',
7-
version="1.5.0",
7+
version="1.6.0",
88
description=(
99
'IPIP.net officially supported IP database ipdb format parsing library'
1010
),

0 commit comments

Comments
 (0)