b.s.m.ResponseHandler(object) : class documentation

Part of bzrlib.smart.message View In Hierarchy

Known subclasses: bzrlib.smart.message.ConventionalResponseHandler, bzrlib.smart.protocol.SmartClientRequestProtocolOne

Abstract base class for an object that handles a smart response.
Method read_response_tuple Reads and returns the response tuple for the current request.
Method read_body_bytes Read and return some bytes from the body.
Method read_streamed_body Returns an iterable that reads and returns a series of body chunks.
Method cancel_read_body Stop expecting a body for this response.
def read_response_tuple(self, expect_body=False):
Reads and returns the response tuple for the current request.
Parametersexpect_bodya boolean indicating if a body is expected in the response. Some protocol versions needs this information to know when a response is finished. If False, read_body_bytes should not be called afterwards. Defaults to False.
Returnstuple of response arguments.
def read_body_bytes(self, count=-1):
Read and return some bytes from the body.
Parameterscountif specified, read up to this many bytes. By default, reads the entire body.
Returnsstr of bytes from the response body.
def read_streamed_body(self):
Returns an iterable that reads and returns a series of body chunks.
def cancel_read_body(self):
Stop expecting a body for this response.

If expect_body was passed to read_response_tuple, this cancels that expectation (and thus finishes reading the response, allowing a new request to be issued). This is useful if a response turns out to be an error rather than a normal result with a body.

API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.