How to get IP address of client from CGI module?

Graham Dumpleton Graham.Dumpleton at gmail.com
Wed Apr 11 00:03:43 EDT 2007


On Apr 11, 12:22 pm, John Nagle <n... at animats.com> wrote:
>    The documentation for Python's CGI module doesn't seem to say how to get
> the IP address of the client.  Don't see an obvious way to get that info
> from reading the source, either. Ideas?
>
>                                         John Nagle

Read the CGI RFC.

  http://www.ietf.org/rfc/rfc3875

Specifically section 4.1.8.

This value should be supplied by way of variable in os.environ as are
all the CGI variables.

Graham




More information about the Python-list mailing list