Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

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();
IP2LocObj.open("data/IP-COUNTRY-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 
Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

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

{{ parent.tldr }}

{{ parent.urlSource.name }}