File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change
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
+
Original file line number Diff line number Diff line change
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" )
You can’t perform that action at this time.
0 commit comments