Looking to implement better geo-location with Python.
Thanks.
Looking to implement better geo-location with Python.
Thanks.
It is not a Python lib. But http://ipinfodb.com/ provides a webservice that can be easily wrapped by Python code
Hostip.info is a community-based project that maintains a database mapping IP addresses to cities. The also have a very easy-to-use API. (Just pass in your ip address after the 'ip=' in the GET request string):
import urllib
urllib.urlopen('http://api.hostip.info/get_html.php?ip=12.215.42.19&position=true').read()
print(response)
You may find these modules useful: MaxMind's GeoIP and its pure version, as well pytz.
I have found that IP2Location.com has Python library, will it be useful for the answering the question?
Below is sample codes from the Website, but you can download and see the library with sample database:
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