Skip to content

Commit eac5f11

Browse files
author
borisz
committed
Add new testscripts test_netspeed.py and test_city_acc.py
1 parent c72f977 commit eac5f11

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

test_city_acc.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/python
2+
3+
import GeoIP
4+
5+
gi = GeoIP.open("/usr/local/share/GeoIP/GeoIPCityConfidenceDist.dat",GeoIP.GEOIP_STANDARD)
6+
7+
gir = gi.record_by_name("www.google.com")
8+
#gir = gi.record_by_addr("24.24.24.24")
9+
10+
if gir != None:
11+
print gir['country_code']
12+
print gir['country_code3']
13+
print gir['country_name']
14+
print gir['city']
15+
print gir['region']
16+
print gir['region_name']
17+
print gir['postal_code']
18+
print gir['latitude']
19+
print gir['longitude']
20+
print gir['area_code']
21+
print gir['time_zone']
22+
print gir['metro_code']
23+
print gir['country_conf']
24+
print gir['region_conf']
25+
print gir['city_conf']
26+
print gir['postal_conf']
27+
print gir['accuracy_radius']
28+

test_netspeed.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/python
2+
3+
import GeoIP
4+
5+
gi = GeoIP.open("/usr/local/share/GeoIP/GeoIPNetspeed.dat",GeoIP.GEOIP_STANDARD)
6+
7+
# GEOIP_UNKNOWN_SPEED, GEOIP_DIALUP_SPEED, GEOIP_CABLEDSL_SPEED or
8+
# GEOIP_CORPORATE_SPEED
9+
10+
print gi.id_by_name("yahoo.com")
11+
print gi.id_by_name("www.maxmind.com") == GeoIP.GEOIP_UNKNOWN_SPEED
12+
print gi.id_by_addr("203.195.93.0")

0 commit comments

Comments
 (0)