httplib.HTTPResponse question

Christopher Baus christopher at baus.net
Fri Jun 25 22:20:00 EDT 2004


> I'm writing an HTTP client test package in python to test my C++ proxy
> server (http://www.summitsage.com/).  For this reason I want to construct
> the (malformed) HTTP requests myself, but use httplib to parse the
> server's response.  I don't see an easy way to do this.  I suspect I could
> construct the response on the socket and have it read the response, but
> this is undocumented.

To answer my own question.  This isn't documented in the standard python
docs, but it is seems to work:

response = httplib.HTTPResponse(sock)
response.begin()
print response.read()





More information about the Python-list mailing list