On Thu, 2011-06-16 at 15:43 -0700, gervaz wrote:
> Hi all, can someone tell me why the read() function in the following
> py3 code returns b''
> >>> h = http.client.HTTPConnection("www.twitter.com")
> >>> h.connect()
> >>> h.request("HEAD", "/", "HTTP 1.0")
> >>> r = h.getresponse()
> >>> r.read()
> b''Because there is no body in a HEAD request. What is useful are the Content-Type, Content-Length, and etag headers. Is r.getcode() == 200? That indicates a successful response; you *always* much check the response code before interpreting the response. Also I'm pretty sure that "HTTP 1.0" is wrong. -- http://mail.python.org/mailman/listinfo/python-list
