Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_district():
db = ipdb.District("c:/work/ipdb/china_district.ipdb")
print(db.is_ipv4(), db.is_ipv6())
print(db.languages())
print(db.fields())
print(db.build_time())
for A in range(223):
for B in range (255):
try:
print(db.find("%d.%d.114.144" % (A, B), "CN"))
except ipdb.IPNotFound as e:
print(e)
try:
print(db.find("1.1.1.1", "CN"))
except ipdb.IPNotFound as e: # ip not found
print(e)
except ipdb.DatabaseError as e: # database file size error