Geo Location extracted from visitors ip address

Grant Edwards invalid at invalid.invalid
Mon Jul 8 16:27:21 CEST 2013


On 2013-07-06, ?????????? Gr33k <nikos at superhost.gr> wrote:
> Yes i know iam only storing the ISP's city instead of visitor's homeland 
> but this is the closest i can get:
>
> try:
>    gi = pygeoip.GeoIP('/home/nikos/GeoLiteCity.dat')
>    city = gi.time_zone_by_addr( os.environ['HTTP_CF_CONNECTING_IP'] )
>    host = socket.gethostbyaddr( os.environ['HTTP_CF_CONNECTING_IP'] )
> except Exception as e:
>    host = repr(e)
>
>
> Tried it myself and it falsey said that i'am from Europe/Athens (capital 
> of Greece) while i'am from Europe/Thessaloniki (sub-capital of Greece)
>
> If we can pin-point the uvisitor more accurately plz let me know.

For the Nth time: you can't.

-- 
Grant Edwards               grant.b.edwards        Yow! HOORAY, Ronald!!
                                  at               Now YOU can marry LINDA
                              gmail.com            RONSTADT too!!



More information about the Python-list mailing list