Showing IP address of a user...

Fazer faizan at jaredweb.com
Fri Aug 1 13:10:17 EDT 2003


Jim Dabell <jim-usenet at jimdabell.com> wrote in message news:<pg2dnSgwIbO4O7qiRTvUqg at giganews.com>...
> Fazer wrote:
> 
> > I was wondering how I can show an IP address of a person who visits a
> > Python web-page?  Would I have to use Environment variables to access
> > Apache's server variables which hold such values like in PHP or what?
> 
> I see you've already been given answers to this, however bear in mind that
> what you are determining is the IP address of the client, not the IP
> address of the person visiting the page.  In many cases, the two are not
> the same, such as when the visitor is using a proxy.
> 
> There's no reliable way of getting the IP address of the person, but you can
> make things a little more reliable by examining the X_FORWARDED_FOR header
> as well, since many proxies add this header to their requests (also bear in
> mind that they may be private addresses, such as 10.0.0.1).

Oh, thanks for the reference Jim!  I will keep that in mind.




More information about the Python-list mailing list