Over a million developers have joined DZone.

IP2Location Python Library

DZone's Guide to

IP2Location Python Library

Free Resource
IP2Location Python Library is used to utilize all of the IP2Locationâ„¢ database products. This API is meant to allow easy integration between your program written in Python and the IP2Location Binary (.BIN) data file which will allow you to query the data for information like Country, Region, City, ISP, Latitude, Longitude, Domain, ZIP code, Time zone, ISP, Domain name, Connection type, Area Code and Weather station code. It has been optimized for speed and memory utilization. Developers can use the API to query all IP2Locationâ„¢ binary databases from http://www.ip2location.com/python.aspx for applications written in Python. Please visit http://www.ip2location.com for more geolocation information.

import IP2Location;

IP2LocObj = IP2Location.IP2Location();
rec = IP2LocObj.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 

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}