Newbie Q: CGI
Michal Wallace
sabren at manifestation.com
Thu Jun 8 00:51:57 EDT 2000
On Thu, 8 Jun 2000, Steven Adams wrote:
> Hi,
>
> How do you get the IP number from a request for a web page? gethostbyname()
> and gethostbyaddress() weren't mentioned anywhere in the cgi module docs
> (that I could see, did I miss it?)
>
> simple problem, but I just can't find the answer...
Hey Steven,
If I get what you're asking, you don't need the cgi module at all.
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.
Cheers,
- Michal
------------------------------------------------------------------------
Zike Interactive http://www.zike.net/ http://zike.sourceforge.net/
------------------------------------------------------------------------
More information about the Python-list
mailing list