faqts : Computers : Programming : Languages : Python : Common Problems : Web Programming

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

4 of 11 people (36%) answered Yes
Recently 3 of 8 people (38%) answered Yes

Entry

How do you get the IP number from a request for a web page?

Jun 9th, 2000 00:07
unknown unknown, Michal Wallace, Chuck


Try putting this in your script:

#--start
import os
print os.environ["REMOTE_HOST"]
#--end

By the way, using the weblib wrapper ( http://weblib.sourceforge.net/ ), 
that's the entire script.

----------

Ah, but using the CGI Wrapper from Webware, it would only be:

#--start
print environ["REMOTE_HOST"]
#--end

  ;-)

http://webware.sourceforge.net    -- (forgot the URL)