On Thu, Jun 16, 2011 at 4:43 PM, gervaz <ger...@gmail.com> 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''
You mean why does it return an empty byte sequence? Because the HEAD method only requests the response headers, not the body, so the body is empty. If you want to see the response body, use GET. Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list