
Requirements
GeoIP C Library must be installed.
Python version 2.0 or higher is recommended.
Download
Download open
source Python API.
Install
This should work on most UNIX and GNU/Linux platforms.
python2 setup.py build
python2 setup.py install
|  |
Usage
The following code looks up the country code by hostname:
import GeoIP
gi = GeoIP.new(GeoIP.GEOIP_MEMORY_CACHE)
print gi.country_code_by_addr("203.195.93.0")
|  |
For additional examples, see test.py inside the distribution.
|