Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #50033
| References | <kr75jj$eqv$1@news.grnet.gr> <mailman.4310.1373054197.3114.python-list@python.org> <kr7me1$jco$1@news.grnet.gr> <kr7mjs$jco$2@news.grnet.gr> <kr7n56$jco$3@news.grnet.gr> |
|---|---|
| Date | 2013-07-05 20:56 -0400 |
| Subject | Re: Geo Location extracted from visitors ip address |
| From | Joel Goldstick <joel.goldstick@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4319.1373072195.3114.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
On Fri, Jul 5, 2013 at 8:08 PM, Νίκος Gr33k <nikos@superhost.gr> wrote:
> Στις 6/7/2013 2:58 πμ, ο/η Νίκος Gr33k έγραψε:
>
> Στις 6/7/2013 2:55 πμ, ο/η Νίκος Gr33k έγραψε:
>>
>>> Στις 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://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.
> >>> import pygeoip
>
> >>> gic = pygeoip.GeoIP('/root/**GeoIPCity.dat')
> 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)
>
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<http://mail.python.org/mailman/listinfo/python-list>
>
--
Joel Goldstick
http://joelgoldstick.com
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Geo Location extracted from visitors ip address Νίκος Gr33k <nikos@superhost.gr> - 2013-07-05 22:08 +0300
Re: Geo Location extracted from visitors ip address Tim Chase <python.list@tim.thechases.com> - 2013-07-05 14:58 -0500
Re: Geo Location extracted from visitors ip address Νίκος Gr33k <nikos@superhost.gr> - 2013-07-06 02:55 +0300
Re: Geo Location extracted from visitors ip address Νίκος Gr33k <nikos@superhost.gr> - 2013-07-06 02:58 +0300
Re: Geo Location extracted from visitors ip address Νίκος Gr33k <nikos@superhost.gr> - 2013-07-06 03:08 +0300
Re: Geo Location extracted from visitors ip address Joel Goldstick <joel.goldstick@gmail.com> - 2013-07-05 20:56 -0400
Re: Geo Location extracted from visitors ip address Νίκος Gr33k <nikos@superhost.gr> - 2013-07-06 04:10 +0300
Re: Geo Location extracted from visitors ip address Νίκος Gr33k <nikos@superhost.gr> - 2013-07-06 04:41 +0300
Re: Geo Location extracted from visitors ip address Νίκος Gr33k <nikos@superhost.gr> - 2013-07-06 11:01 +0300
Re: Geo Location extracted from visitors ip address Chris Angelico <rosuav@gmail.com> - 2013-07-06 18:30 +1000
Re: Geo Location extracted from visitors ip address Νίκος Gr33k <nikos@superhost.gr> - 2013-07-06 11:41 +0300
Re: Geo Location extracted from visitors ip address Tim Chase <python.list@tim.thechases.com> - 2013-07-06 06:20 -0500
Re: Geo Location extracted from visitors ip address Νίκος Gr33k <nikos@superhost.gr> - 2013-07-06 23:14 +0300
Re: Geo Location extracted from visitors ip address Tim Chase <python.list@tim.thechases.com> - 2013-07-06 15:32 -0500
Re: Geo Location extracted from visitors ip address Νίκος Gr33k <nikos@superhost.gr> - 2013-07-06 23:51 +0300
Re: Geo Location extracted from visitors ip address Νίκος Gr33k <nikos@superhost.gr> - 2013-07-07 12:40 +0300
Re: Geo Location extracted from visitors ip address Dave Angel <davea@davea.name> - 2013-07-06 07:49 -0400
Re: Geo Location extracted from visitors ip address Robert Kern <robert.kern@gmail.com> - 2013-07-06 11:21 +0100
Re: Geo Location extracted from visitors ip address Grant Edwards <invalid@invalid.invalid> - 2013-07-08 14:27 +0000
Re: Geo Location extracted from visitors ip address Grant Edwards <invalid@invalid.invalid> - 2013-07-08 14:27 +0000
Re: Geo Location extracted from visitors ip address Joel Goldstick <joel.goldstick@gmail.com> - 2013-07-05 21:31 -0400
Re: Geo Location extracted from visitors ip address Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-07-05 22:52 -0400
Re: Geo Location extracted from visitors ip address Νίκος Gr33k <nikos@superhost.gr> - 2013-07-06 10:10 +0300
Re: Geo Location extracted from visitors ip address Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-07-06 10:43 -0400
Re: Geo Location extracted from visitors ip address Νίκος Gr33k <nikos@superhost.gr> - 2013-07-06 23:12 +0300
Re: Geo Location extracted from visitors ip address Tim Chase <python.list@tim.thechases.com> - 2013-07-06 15:33 -0500
Re: Geo Location extracted from visitors ip address Νίκος Gr33k <nikos@superhost.gr> - 2013-07-06 23:49 +0300
Re: Geo Location extracted from visitors ip address Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-07-06 18:36 -0400
Re: Geo Location extracted from visitors ip address Support by Νίκος <nikos@superhost.gr> - 2013-07-05 22:59 +0300
Re: Geo Location extracted from visitors ip address Tim Roberts <timr@probo.com> - 2013-07-05 13:44 -0700
Re: Geo Location extracted from visitors ip address Dave Angel <davea@davea.name> - 2013-07-05 17:18 -0400
Re: Geo Location extracted from visitors ip address Chris Angelico <rosuav@gmail.com> - 2013-07-06 11:06 +1000
Re: Geo Location extracted from visitors ip address Tim Chase <python.list@tim.thechases.com> - 2013-07-05 17:21 -0500
Re: Geo Location extracted from visitors ip address Grant Edwards <invalid@invalid.invalid> - 2013-07-05 22:24 +0000
[OT] Re: Geo Location extracted from visitors ip address Tony the Tiger <tony@tiger.invalid> - 2013-07-06 13:23 -0500
Re: Geo Location extracted from visitors ip address Joel Goldstick <joel.goldstick@gmail.com> - 2013-07-05 15:23 -0400
Re: Geo Location extracted from visitors ip address Jerry Hill <malaclypse2@gmail.com> - 2013-07-05 15:28 -0400
Re: Geo Location extracted from visitors ip address Support by Νίκος <nikos@superhost.gr> - 2013-07-05 22:43 +0300
csiph-web