• Your shopping cart is empty!

IP2Location IP Geolocation Python Library

This IP Geolocation Python Library supports all IP2Location™ IP database products. It has been optimized for speed and memory utilization. Developers can use this API to query all IP2Location™ binary databases for IPv4 and IPv6 address to get geolocation data of that IP address.

  1. Unzip the package.
  2. Execute:
    python setup.py build
  3. Execute:
    python setup.py install
Sample Codes
import IP2Location, os

    Cache the database into memory to accelerate lookup speed.
    WARNING: Please make sure your system have sufficient RAM to use this feature.
# database = IP2Location.IP2Location(os.path.join("data", "IPV6-COUNTRY.BIN"), "SHARED_MEMORY")
rec = database.get_all("")

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
print rec.address_type
print rec.category