Reading a client's header from Python CGI script?
Posted
by jawonlee
on Stack Overflow
See other posts from Stack Overflow
or by jawonlee
Published on 2010-04-20T17:39:24Z
Indexed on
2010/04/20
17:53 UTC
Read the original article
Hit count: 283
I'm writing a very simple web service, written in Python and run as CGI on an Apache server.
According to Python docs (somewhere... I forgot where), I can use sys.stdin to read the data POSTed by a random client, and this has been working fine. However, I would like to be able to read the HTTP header information as well - incoming IP, user agent, and so on. I'd also like to keep it very simple for now, by using only Python libraries (so no mod-python). How do I do this?
© Stack Overflow or respective owner