Geo Location extracted from visitors ip address

Νίκος Gr33k nikos at superhost.gr
Fri Jul 5 19:55:43 EDT 2013


Στις 5/7/2013 10:58 μμ, ο/η Tim Chase έγραψε:
> On 2013-07-05 22:08, Νίκος Gr33k wrote:
>> Is there a way to extract out of some environmental variable the
>> Geo location of the user being the city the user visits out website
>> from?
>>
>> Perhaps by utilizing his originated ip address?
>
> Yep.  You can get an 11MB database (17MB uncompressed)
>
> http://dev.maxmind.com/geoip/legacy/downloadable/

> http://pypi.python.org/pypi/pygeoip/         # pure Python

Thank you very much Tim.
i am know tryitn to use it as:

import pygeoip

try:
   gic = pygeoip.GeoIP('/root/GeoIPCity.dat')
   host = gic.time_zone_by_addr( os.environ['HTTP_CF_CONNECTING_IP'] )
except Exception as e:
   host = repr(e)

lets hope it will work!


-- 
What is now proved was at first only imagined!



More information about the Python-list mailing list