urllib2 chunked encoding

Sean Harper harper.sean at gmail.com
Thu Jan 26 10:58:46 EST 2006


I am trying to download some html using mechanize:

br=Browser()
r = br.open("url")
b = r.read()
print b

I have used this code successfully many times and now I have run across an
instance where it fails. It opens the url without error but then prints
nothing.

Looking at the http headers when it works fine it has a "Content-Length:
XXXXX"

And when it does not work it has no Content-Length and it has
Transfer-Encoding: chunked

It could be that I am doing something else wrong (like maybe that site needs
some different headers or something), but I had never seen this before so it
made me suspicious.

Does urllib2 and mechanize deal with chunked encoding properly?  Is there
something else that I need to do to make it work?

Thanks,
Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060126/9fcf0b14/attachment.html>


More information about the Python-list mailing list