Newbie Q: CGI

echuck3 at my-deja.com echuck3 at my-deja.com
Thu Jun 8 17:01:38 EDT 2000


In article <Pine.BSF.4.10.10006080045100.23617-100000 at chi.pair.com>,
  Michal Wallace <sabren at manifestation.com> wrote:
> 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/
> ----------------------------------------------------------------------
--


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)

-Chuck


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list