Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.039 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'url:pypi': 0.03; 'root': 0.05; 'work!': 0.07; '__init__': 0.09; 'happen?': 0.09; 'skip:/ 10': 0.09; 'try:': 0.09; 'utilizing': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'desktops': 0.16; 'encoding)': 0.16; 'likely.': 0.16; 'mode,': 0.16; 'serve.': 0.16; 'through.': 0.16; '\xc2\xa0you': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'trying': 0.19; 'pointed': 0.19; '>>>': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; '>>>': 0.24; 'denied': 0.24; 'lets': 0.24; 'url:dev': 0.24; 'cc:2**0': 0.24; 'permission': 0.26; 'skip:" 30': 0.26; 'header:In-Reply-To:1': 0.27; 'host': 0.29; 'skip:p 30': 0.29; 'tim': 0.29; 'message- id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; "skip:' 10": 0.31; '"",': 0.31; '>>>>': 0.31; 'chase': 0.31; 'extract': 0.31; 'file:': 0.31; 'file': 0.32; 'probably': 0.32; 'open': 0.33; 'linux': 0.33; 'url:python': 0.33; '(most': 0.33; 'fri,': 0.33; 'subject:from': 0.34; 'except': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'skip:" 50': 0.36; 'url:listinfo': 0.36; 'url:org': 0.36; 'should': 0.36; 'being': 0.38; 'skip:& 10': 0.38; 'thank': 0.38; 'problems': 0.38; 'hat': 0.38; 'skip:\xcf 20': 0.38; 'issue': 0.38; 'pm,': 0.38; 'recent': 0.39; 'skip:& 20': 0.39; 'aside': 0.39; 'url:mail': 0.40; 'even': 0.60; 'skip:u 10': 0.60; 'phones': 0.60; 'hope': 0.61; 'skip:o 30': 0.61; 'first': 0.61; 'back': 0.62; "you've": 0.63; 'information': 0.63; 'such': 0.63; 'more': 0.64; 'city': 0.66; 'wish': 0.70; '8bit%:92': 0.71; '8bit%:100': 0.72; 'jul': 0.74; 'as:': 0.81; 'directory:': 0.84; 'geo': 0.84; 'located.': 0.84; 'subject:Location': 0.84; 'visits': 0.84; '2013,': 0.91; 'joel': 0.91; '8bit%:90': 0.93; 'luck': 0.93; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=eblLHIoDegmqhZ9l0WLHIdGaSjDT9blNzxO2Ojj08Yo=; b=tTC3CO54Hawfjdx7wFLBFqhTArvGBDF7ZKYgDbYVuZ8Y1tWLyOFWtcYi8rGnItfOp2 0QALKOkFtpitC3JlPv6FTu7CDAC+3W4fGZx6ZDofXx//08iIu4airGmaI4KvQvqfTgrJ 0ToRlFy/dT5DA3zfOHKE/WmEUDrgGw+SqTSj338yIgnEn8xKPc9rAcizPIGbA3S7lgSB 2XiHSzAP9PtsxD28Tdh3ELT1oPiuts4XKk7PuWZczZeMfVIQJxrneGLiO/K7zZxL9v1A HYLJFIdP/eutWYk4E6hK6T1GGRcez1vwkoDAigVVJfOC8Y/9O+yeo4uBy+lZoY0uPxqk T7Qw== MIME-Version: 1.0 X-Received: by 10.58.236.70 with SMTP id us6mr8570452vec.89.1373072185861; Fri, 05 Jul 2013 17:56:25 -0700 (PDT) In-Reply-To: References: Date: Fri, 5 Jul 2013 20:56:25 -0400 Subject: Re: Geo Location extracted from visitors ip address From: Joel Goldstick To: =?UTF-8?B?zp3Or866zr/PgiBHcjMzaw==?= Content-Type: multipart/alternative; boundary=047d7bd6a906e3d87604e0cd47c0 Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 247 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1373072195 news.xs4all.nl 15867 [2001:888:2000:d::a6]:41066 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:50033 --047d7bd6a906e3d87604e0cd47c0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, Jul 5, 2013 at 8:08 PM, =CE=9D=CE=AF=CE=BA=CE=BF=CF=82 Gr33k wrote: > =CE=A3=CF=84=CE=B9=CF=82 6/7/2013 2:58 =CF=80=CE=BC, =CE=BF/=CE=B7 =CE=9D= =CE=AF=CE=BA=CE=BF=CF=82 Gr33k =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5: > > =CE=A3=CF=84=CE=B9=CF=82 6/7/2013 2:55 =CF=80=CE=BC, =CE=BF/=CE=B7 =CE= =9D=CE=AF=CE=BA=CE=BF=CF=82 Gr33k =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5: >> >>> =CE=A3=CF=84=CE=B9=CF=82 5/7/2013 10:58 =CE=BC=CE=BC, =CE=BF/=CE=B7 Tim= Chase =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5: >>> >>>> On 2013-07-05 22:08, =CE=9D=CE=AF=CE=BA=CE=BF=CF=82 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 trying to use it as: >>> >>> import pygeoip >>> >>> try: >>> gic =3D pygeoip.GeoIP('/root/**GeoIPCity.dat') >>> host =3D gic.time_zone_by_addr( os.environ['HTTP_CF_**CONNECTING_IP'= ] ) >>> except Exception as e: >>> host =3D repr(e) >>> >>> lets hope it will work! >>> >> >> Just my luck again, >> >> PermissionError(13, '=CE=86=CF=81=CE=BD=CE=B7=CF=83=CE=B7 =CF=80=CF=81= =CF=8C=CF=83=CE=B2=CE=B1=CF=83=CE=B7=CF=82') >> >> =CE=86=CF=81=CE=BD=CE=B7=CF=83=CE=B7 =CF=80=CF=81=CF=8C=CF=83=CE=B2=CE= =B1=CF=83=CE=B7=CF=82 =3D 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. > >>> import pygeoip > > >>> gic =3D pygeoip.GeoIP('/root/**GeoIPCity.dat') > Traceback (most recent call last): > File "", line 1, in > File "/usr/local/lib/python3.3/**site-packages/pygeoip-0.2.6-** > py3.3.egg/pygeoip/__init__.py"**, line 110, in __init__ > self._filehandle =3D codecs.open(filename, 'rb', ENCODING) > File "/usr/local/lib/python3.3/**codecs.py", line 884, in open > file =3D builtins.open(filename, mode, buffering) > Your code is not finding /root/GeoIPCity.dat because your directory has this file: GeoLiteCity.dat > FileNotFoundError: [Errno 2] No such file or directory: > '/root/GeoIPCity.dat' Aside from that you might have some permission problems since the file is owned by root. You should go back to old threads where this issue was explained. As was also pointed out, you only get information about where your isp is located. Phones and tablets find location from triangulating cell towers. I don't think that laptops have that capability, and desktops probably even less likely. What is the purpose that you wish to serve. I don't think you've thought this through. > > >>> > > > > -- > What is now proved was at first only imagined! > -- > http://mail.python.org/**mailman/listinfo/python-list > --=20 Joel Goldstick http://joelgoldstick.com --047d7bd6a906e3d87604e0cd47c0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable



On Fri, Jul 5, 2013 at 8:08 PM, =CE=9D=CE=AF=CE=BA=CE=BF=CF=82 Gr33= k <nikos@superhost.gr> wrote:
=CE=A3=CF=84=CE=B9=CF=82 = 6/7/2013 2:58 =CF=80=CE=BC, =CE=BF/=CE=B7 =CE=9D=CE=AF=CE=BA=CE=BF=CF=82 Gr= 33k =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5:

=CE=A3=CF=84=CE=B9=CF=82 6/7/2013 2:55 =CF=80=CE=BC, =CE=BF/=CE=B7 =CE=9D= =CE=AF=CE=BA=CE=BF=CF=82 Gr33k =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5:
=CE=A3=CF=84=CE=B9=CF=82 5/7/2013 10:58 =CE=BC=CE=BC, =CE=BF/=CE=B7 Tim Cha= se =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5:
On 2013-07-05 22:08, =CE=9D=CE=AF=CE=BA=CE=BF=CF=82 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. =C2=A0You can get an 11MB database (17MB uncompressed)

http://dev.maxmind.com/geoip/legacy/downloadable/

http://p= ypi.python.org/pypi/pygeoip/ =C2=A0 =C2=A0 =C2=A0 =C2=A0 # pure = Python

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

import pygeoip

try:
=C2=A0 =C2=A0gic =3D pygeoip.GeoIP('/root/GeoIPCity.dat') =C2=A0 =C2=A0host =3D gic.time_zone_by_addr( os.environ['HTTP_CF_CONNECTING_IP'] )
except Exception as e:
=C2=A0 =C2=A0host =3D repr(e)

lets hope it will work!

Just my luck again,

PermissionError(13, '=CE=86=CF=81=CE=BD=CE=B7=CF=83=CE=B7 =CF=80=CF=81= =CF=8C=CF=83=CE=B2=CE=B1=CF=83=CE=B7=CF=82')

=CE=86=CF=81=CE=BD=CE=B7=CF=83=CE=B7 =CF=80=CF=81=CF=8C=CF=83=CE=B2=CE=B1= =CF=83=CE=B7=CF=82 =3D Access Denied

Why would that happen?

root@nikos [~]# ls -l GeoLiteCity.dat
-rw-r--r-- 1 root root 17633968 Jul =C2=A03 02:11 GeoLiteCity.dat
root@nikos [~]# chmod +x GeoLiteCity.dat
root@nikos [~]# ls -l GeoLiteCity.dat
-rwxr-xr-x 1 root root 17633968 Jul =C2=A03 02:11 GeoLiteCity.dat*
root@nikos [~]# python
Python 3.3.2 (default, Jun =C2=A03 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.
>>> import pygeoip

>>> gic =3D pygeoip.GeoIP('/root/GeoIPCity.dat')
Traceback (most recent call last):
=C2=A0 File "<stdin>", line 1, in <module>
=C2=A0 File "/usr/local/lib/python3.3/site-packages/pygeoip-0.2= .6-py3.3.egg/pygeoip/__init__.py", line 110, in __init__=
=C2=A0 =C2=A0 self._filehandle =3D codecs.open(filename, 'rb', ENCO= DING)
=C2=A0 File "/usr/local/lib/python3.3/codecs.py", line 884= , in open
=C2=A0 =C2=A0 file =3D builtins.open(filename, mode, buffering)

Your code is not finding /root/GeoIPCity.dat becau= se your directory has this file: GeoLiteCity.dat
FileNotFoundError: [Errno 2] No such file or directory: '/root/GeoIPCit= y.dat'

Aside from that you might have s= ome permission problems since the file is owned by root.=C2=A0 You should g= o back to old threads where this issue was explained.

As was also pointed out, you only get information about wher= e your isp is located.=C2=A0 Phones and tablets find location from triangul= ating cell towers.=C2=A0 I don't think that laptops have that capabilit= y, and desktops probably even less likely.

What is the purpose that you wish to serve.=C2=A0 I don'= t think you've thought this through.

>>>



--
What is now proved was at first only imagined!
--
http://mail.python.org/mailman/listinfo/python-list



--
--047d7bd6a906e3d87604e0cd47c0--