HTTP ResponseNotReady

MRAB python at mrabarnett.plus.com
Tue Oct 4 16:53:48 EDT 2011


On 04/10/2011 21:29, pedr0 wrote:
> Hi solved this problem, I have to add:
>
>
>
> #connection
> http_connection = http.client.HTTPConnection('www.xxx.net',80,timeout=60)
> #first request
> http_connection.request("POST", "/",params,headers=headers_)
> r1 = http_connection.getresponse()
> r1.read()  // THIS ONE
> #second request
> http_connection.request("GET", "/","",headers=headers_)
> r2 = http_connection.getresponse()
>
>
> Someone know if this is a bug ?
>
It's not a bug.

The documentation for "getresponse" says:

"""HTTPConnection.getresponse()
Should be called after a request is sent to get the response from the 
server. Returns an HTTPResponse instance.

Note
Note that you must have read the whole response before you can send a 
new request to the server.
"""

The note is highlighted.



More information about the Python-list mailing list