Looking for a way to identify the city of my website visitors.
The closet I have gone is to come up with the visitor's ISP city:
gi = pygeoip.GeoIP('/usr/local/share/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)
But today i was searching again for this and found out about geoip2, maybe that would help more.
>>> import geoip2
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named 'geoip2'
>>> client = geoip2.webservices.Client(42, 'abcdef123456')
>>> omni = client.omni('184.108.40.206')
>>> country = omni.country
I cant even import the module even though my 'pip install geopip2' was successful
There is definately i way to identify the users location based solely on its ip address as this site does it: http://www.geoiptool.com/
Google, MS, facebook and twitter are not the only ones that can do it?
Perhaps this is being done by giving longitude and latitude?