Python Library

This module is a Python Library to support all IP2Location™ database products. It has been optimized for speed and memory utilization. Developers can use this API to query all IP2Location™ binary databases for applications written in Python.

Download IP2Location Python Library (997.02 kB) Version: 6.0.0

 

Installation
  1. Unzip the package.
  2. Execute python setup.py build
  3. Execute python setup.py install

 

Sample Codes
import IP2Location;

IP2LocObj = IP2Location.IP2Location();
IP2LocObj.open("data/IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE-TIMEZONE-ISP-DOMAIN-NETSPEED-AREACODE-WEATHER-MOBILE-ELEVATION-USAGETYPE-SAMPLE.BIN");
rec = IP2LocObj.get_all("19.5.10.1");

print rec.country_short
print rec.country_long
print rec.region
print rec.city
print rec.isp
print rec.latitude
print rec.longitude
print rec.domain
print rec.zipcode
print rec.timezone
print rec.netspeed
print rec.idd_code
print rec.area_code
print rec.weather_code
print rec.weather_name
print rec.mcc
print rec.mnc
print rec.mobile_brand
print rec.elevation
print rec.usage_type

 

Sample Database (BIN)

Evaluation version of the database file having limited range of IP address information. You can query all IP addresses from 0.0.0.0 to 99.255.255.255 only.