from twisted.internet import reactor, defer, protocol
from twisted.internet.protocol import ClientFactory
from twisted import version as twisted_version
+from twisted.python import log
from twisted.web2.client.interfaces import IHTTPClientManager
from twisted.web2.client.http import ProtocolError, ClientRequest, HTTPClientProtocol
from twisted.web2 import stream as stream_mod, http_headers
req = self.request_queue.pop(0)
self.response_queue.append(req)
req.deferResponse = self.proto.submitRequest(req, False)
- req.deferResponse.addCallback(self.requestComplete)
- req.deferResponse.addErrback(self.requestError)
+ req.deferResponse.addCallbacks(self.requestComplete, self.requestError)
def requestComplete(self, resp):
req = self.response_queue.pop(0)
+ log.msg('%s of %s completed with code %d' % (req.method, req.uri, resp.code))
req.deferRequest.callback(resp)
def requestError(self, error):
req = self.response_queue.pop(0)
+ log.msg('Download of %s generated error %r' % (req.uri, error))
req.deferRequest.errback(error)
def clientBusy(self, proto):