getting clients ip address

Chris Liechti cliechti at gmx.net
Sat Sep 7 16:32:57 EDT 2002


"Leader" <leader730 at hotmail.com> wrote in
news:r0te9.25654$6W3.867995 at weber.videotron.net: 

> Hello, I am using Python for my website, more specifically
> Spyce+mod_python, what I want to do is print out the clients ip
> address on the site so it can say something like "your ip
> is:xxx.xxx.xxx.xxx" basicly the python version of <?php echo
> getenv("REMOTE_ADDR"); ?> I'm sure I saw something a while ago while
> browsing through the module docs but I can't find it anymore.

something like:

>>> import os
>>> print os.environ["REMOTE_ADDR"]

HTH, 
chris

-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list