MaxMind
Support My Account FAQ My Order
Support My Account FAQ My Order

Apache Module
C
C# Class
Java Class
MS COM Object
Pascal
Perl Module
PHP Module
Python Class
Ruby Module
VB.Net
Support Center


GeoIP Python API

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.


MaxMind, GeoIP and related marks are registered trademarks of MaxMind, Inc.
Copyright © 2008 MaxMind, Inc. All Rights Reserved. Terms of use.