Retrieving http headers from HTTPConnection object

Marco Bizzarri marco.bizzarri at gmail.com
Mon Sep 1 07:18:16 EDT 2008


On Mon, Sep 1, 2008 at 1:06 PM, jorma kala <jjkk73 at gmail.com> wrote:
> Hi,
>
> when using  httplib for http requests, like for example:
>
>
>    conn = httplib.HTTPConnection("www.python.org")
>    conn.request("GET", "/index.html")
>
> Is it possible to retrieve the complete http request in string form :
>
>
> GET /index.html HTTP/1.1
> Host: www.python.org
> User-Agent: ...
> Accept:   ...
> Accept-Language:
> Accept-Encoding:
> Accept-Charset:
> Keep-Alive:
> Connection:
>
> I mean does  the HTTPConnection object have a property that stores this ?
> or is it retrievable by some other form?
>
> Thanks a lot.
> --

Looking at the code of HTTPConnection, all that goes through the
_output message (including, therefore, the putheaders) are appended to
the self._buffer list.

Regards
Marco

-- 
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.com/



More information about the Python-list mailing list