Στις 6/7/2013 2:58 πμ, ο/η Îίκος Gr33k ÎγÏαψε:
Στις 6/7/2013 2:55 πμ, ο/η Îίκος Gr33k ÎγÏαψε:
Στις 5/7/2013 10:58 μμ, ο/η TimChase ÎγÏαψε:
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://dev.maxmind..com/geoip/legacy/downloadable/>
http://pypi.python.org/pypi/**pygeoip/<
http://pypi.python.org/pypi/pygeoip/> # pure Python
Thank you very much Tim.
i am know trying 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!
Just my luck again,
PermissionError(13, 'ΆÏνηση Ï€Ïόσβασης')
ΆÏνηση Ï€Ïόσβασης = Access Denied
Why would that happen?
root@nikos [~]# ls -l GeoLiteCity.dat
-rw-r--r-- 1 root root 17633968 Jul 3 02:11 GeoLiteCity.dat
root@nikos [~]# chmod +x GeoLiteCity.dat
root@nikos [~]# ls -l GeoLiteCity.dat
-rwxr-xr-x 1 root root 17633968 Jul 3 02:11 GeoLiteCity.dat*
root@nikos [~]# python
Python 3.3.2 (default, Jun 3 2013, 16:18:05)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.3/**site-packages/pygeoip-0.2.6-**
py3.3.egg/pygeoip/__init__.py"**, line 110, in __init__
self._filehandle = codecs.open(filename, 'rb', ENCODING)
File "/usr/local/lib/python3.3/**codecs.py", line 884, in open
file = builtins.open(filename, mode, buffering)