File: test_city.py

package info (click to toggle)
python-geoip 1.2.1-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 108 kB
  • ctags: 43
  • sloc: ansic: 262; python: 45; makefile: 3
file content (20 lines) | stat: -rwxr-xr-x 452 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/python

import GeoIP

gi = GeoIP.open("/usr/local/share/GeoIP/GeoIPCity.dat",GeoIP.GEOIP_STANDARD)

gir = gi.record_by_name("www.google.com")
#gir = gi.record_by_addr("24.24.24.24")

if gir != None:
	print gir['country_code']
	print gir['country_code3']
	print gir['country_name']
	print gir['region']
	print gir['city']
	print gir['postal_code']
	print gir['latitude']
	print gir['longitude']
	print gir['dma_code']
	print gir['area_code']