File: test.py

package info (click to toggle)
python-geoip 1.2.0-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 92 kB
  • ctags: 36
  • sloc: ansic: 232; python: 35; makefile: 2
file content (12 lines) | stat: -rwxr-xr-x 374 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/python

import GeoIP

#gi = GeoIP.new(GeoIP.GEOIP_STANDARD)
gi = GeoIP.new(GeoIP.GEOIP_MEMORY_CACHE)
#gi = GeoIP.open("/usr/local/share/GeoIP/GeoIP.data",GeoIP.GEOIP_STANDARD)

print gi.country_code_by_name("yahoo.com")
print gi.country_name_by_name("www.government.de")
print gi.country_code_by_addr("203.195.93.0")
print gi.country_name_by_addr("203.195.93.0")