Getting ip address and browser info

Thomas Wouters thomas at xs4all.net
Sun Jul 9 05:50:36 EDT 2000


On Sat, Jul 08, 2000 at 04:32:08PM -0700, Curtis Jensen wrote:
> Using python CGI how can I get the ip address and browser info of the
> requestion party?  Thanks.

They're stored as environment variables. I'm not sure which environment
variables are CGI-standard and which are Apache-specific, but I think you
want 'REMOTE_ADDR' and 'HTTP_USER_AGENT', respectively. You can get at them
using 'os.environ[<variable name>]', in Python.

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list