self.agent = Agent(reactor, pool=pool)
self.deferred = self.agent.request(
'GET',
self.url,
Headers({'User-Agent': ['Mozilla/5.0']})
)
self.deferred.addCallback(self.gotResponse)
But gotResponse called for every part of received data, not for all of it. I could collect it, but how to know that i got all the data?
EDIT:
I found this (from the words “If the response body has been completely received“) but still have no idea how to implement this. I mean, what does “the failure will wrap…” mean?
The twisted documentation provides an example of how to do this.
From http://twistedmatrix.com/documents/current/web/howto/client.html
The connectionLost() method of BeginningPrinter will be called when the request has completed.
It looks like checking
if reason.check(twisted.web.client.ResponseDone)will tell you whether or not it was successful.