IP2Location Python Library
Join the DZone community and get the full member experience.Join For Free
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("220.127.116.11"); 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
Python (language) Library
Opinions expressed by DZone contributors are their own.