peter
2015-11-29 13:43:52 UTC
hi,
looking over:
https://twistedmatrix.com/documents/14.0.2/_downloads/response.py
im not really sure why one would use the line:
self.remaining = 1024 * 10
this suggest to me that one knew what kind of page size was
expected...but what if you dont?
wouldnt it make more sense to use someting like this:
def dataReceived(self, bytes):
self.page_content = self.page_content + bytes
this would sum up all the data until connectionLost is called.
and in connectionLost():
def connectionLost(self, reason):
print 'Finished receiving body:', reason.getErrorMessage()
self.finished.callback(self.page_content)
and then print it?
also i dont get why one would use
return finished
in cbRequest. where is this finished returned to?
its called via:
d.addCallback(cbRequest)
isnt the result from cbRequest thrown away?
i would expect the line to read:
new_deferred = d.addCallback(cbRequest)
thx for your answers
looking over:
https://twistedmatrix.com/documents/14.0.2/_downloads/response.py
im not really sure why one would use the line:
self.remaining = 1024 * 10
this suggest to me that one knew what kind of page size was
expected...but what if you dont?
wouldnt it make more sense to use someting like this:
def dataReceived(self, bytes):
self.page_content = self.page_content + bytes
this would sum up all the data until connectionLost is called.
and in connectionLost():
def connectionLost(self, reason):
print 'Finished receiving body:', reason.getErrorMessage()
self.finished.callback(self.page_content)
and then print it?
also i dont get why one would use
return finished
in cbRequest. where is this finished returned to?
its called via:
d.addCallback(cbRequest)
isnt the result from cbRequest thrown away?
i would expect the line to read:
new_deferred = d.addCallback(cbRequest)
thx for your answers