>>>>> Fred Atkinson <fatkin...@mishmash.com> (FA) wrote:
>FA> On Wed, 08 Jul 2009 12:29:54 +0200, Piet van Oostrum <p...@cs.uu.nl> >FA> wrote: >>> Something like: >>> >>> #! /usr/bin/env python >>> >>> import cgi >>> from os import getenv >>> >>> print "Content-type: text/html" >>> print >>> >>> ipaddr = (getenv("HTTP_CLIENT_IP") or >>> getenv("HTTP_X_FORWARDED_FOR") or >>> getenv("HTTP_X_FORWARDED_FOR") or >>> getenv("REMOTE_ADDR") or >>> "UNKNOWN") >>> >>> print ipaddr >FA> That did it. >FA> I wonder why they don't just have a function to return it instead of >FA> putting you through all of that? I see now that I had getenv("HTTP_X_FORWARDED_FOR") or duplicated. -- Piet van Oostrum <p...@cs.uu.nl> URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4] Private email: p...@vanoostrum.org -- http://mail.python.org/mailman/listinfo/python-list