<div dir="ltr">I am new with Twisted so chances are that this is *not* a bug. If that is the case, I would very much appreciate it if you help me understand what I am doing incorrectly.<div><br></div><div>I have some very simple code to just download a particular page via HTTP. The problem I'm running into is that I get PartialDownloadErrors for some sites, while others load fine. And when I examine the HTTP response, it looks like the page fully downloaded. The traceback and logging information have been very unhelpful. I cannot determine what exactly is causing the error. <br><div><br></div><font face="monospace, monospace">import sys<br>from twisted.internet.task import react<br>from twisted.python.log import err, startLogging<br>from twisted.web.client import Agent, BrowserLikeRedirectAgent, readBody<br>from twisted.web.http_headers import Headers<br>from twisted.internet import reactor<br>from twisted.internet.ssl import ClientContextFactory<br><br>def cbBody(r):<br>    print "Response body:"<br>    print r</font><div><font face="monospace, monospace"><br>def cbRequest(response):<br>    print "Received response"<br>    d = readBody(response)<br>    d.addCallbacks(cbBody, err)<br>    return d<br><br>def err(e):<br>    try:<br>        e.raiseException()<br>    except Exception, err:<br>        pass</font></div><div><font face="monospace, monospace">        # display HTTP response<br>        # print err.response<br>    e.printTraceback()<br>    sys.stderr.write(str(e))<br><br>def main(reactor):<br>    startLogging(sys.stdout)<br>    agent = BrowserLikeRedirectAgent(Agent(reactor))<br>    d = agent.request("GET", b"<a href="http://www.google.com">http://www.google.com</a>",<br>            Headers({'User-Agent': ['Twisted Web Client Example']}),<br>            None)<br>    d.addCallbacks(cbRequest, err)<br>    return d<br><br>react(main)</font><div><br></div></div><div><div><font face="monospace, monospace">2015-04-13 14:13:11-0400 [-] Log opened.</font></div><div><font face="monospace, monospace">2015-04-13 14:13:11-0400 [-] Starting factory <twisted.web.client._HTTP11ClientFactory instance at 0x10303f560></font></div><div><font face="monospace, monospace">2015-04-13 14:13:11-0400 [HTTP11ClientProtocol,client] Received response</font></div><div><font face="monospace, monospace">2015-04-13 14:13:11-0400 [HTTP11ClientProtocol,client] Traceback (most recent call last):</font></div><div><font face="monospace, monospace">2015-04-13 14:13:11-0400 [HTTP11ClientProtocol,client] Failure: twisted.web.client.PartialDownloadError: 200 OK</font></div><div><font face="monospace, monospace">2015-04-13 14:13:11-0400 [HTTP11ClientProtocol,client] [Failure instance: Traceback (failure with no frames): <class 'twisted.web.client.PartialDownloadError'>: 200 OK</font></div><div><font face="monospace, monospace">2015-04-13 14:13:11-0400 [HTTP11ClientProtocol,client] Stopping factory <twisted.web.client._HTTP11ClientFactory instance at 0x10303f560></font></div><div><font face="monospace, monospace">2015-04-13 14:13:11-0400 [-] Main loop terminated.</font></div></div></div><div><font face="monospace, monospace"><br></font></div><div><font face="arial, helvetica, sans-serif">Thanks!</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Chris</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><br></font></div></div>