Showing IP address of a user...
Jim Dabell
jim-usenet at jimdabell.com
Wed Jul 30 07:01:48 EDT 2003
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).
--
Jim Dabell
More information about the Python-list
mailing list