Part of twisted.web.client View Source View In Hierarchy
Response
instance describes an HTTP response received from an HTTP server.
Response
should not be subclassed or instantiated.
Instance Variables | version | A three-tuple describing the protocol and protocol version of the response.
The first element is of type str , the second and third are of
type int . For example, ('HTTP', 1, 1) .
(type: tuple
) |
code | The HTTP status code of this response.
(type: int
) | |
phrase | The HTTP reason phrase of this response.
(type: str
) | |
headers | The HTTP response headers of this response.
(type: Headers
) | |
length | The number of bytes expected to be in the body of this response or
UNKNOWN_LENGTH if the server did not indicate how many bytes
to expect. For HEAD responses, this will be 0; if the response
includes a Content-Length header, it will be available in
headers .
(type: int or something else
) | |
_transport | The transport which is delivering this response. | |
_bodyProtocol | The IProtocol provider to which the body is delivered.
None before one has been registered with
deliverBody .
| |
_bodyBuffer | A list of the strings passed to bodyDataReceived
before deliverBody is called. None afterwards.
| |
_state | Indicates what state this Response instance
is in, particularly with respect to delivering bytes from the response body
to an application-suppled protocol object. This may be one of
'INITIAL' , 'CONNECTED' ,
'DEFERRED_CLOSE' , or 'FINISHED' , with the
following meanings:
|
Method | __init__ | Undocumented |
Method | deliverBody | Register an IProtocol provider to receive the response
body. |
Method | _deliverBody_INITIAL | Deliver any buffered data to protocol and prepare to
deliver any |
Method | _deliverBody_CONNECTED | It is invalid to attempt to deliver data to a protocol when it is |
Method | _deliverBody_DEFERRED_CLOSE | Deliver any buffered data to protocol and then disconnect
the |
Method | _deliverBody_FINISHED | It is invalid to attempt to deliver data to a protocol after the |
Method | _bodyDataReceived | Called by HTTPClientParser with chunks of data from the response body. |
Method | _bodyDataReceived_INITIAL | Buffer any data received for later delivery to a protocol passed to |
Method | _bodyDataReceived_CONNECTED | Deliver any data received to the protocol to which this Response |
Method | _bodyDataReceived_DEFERRED_CLOSE | It is invalid for data to be delivered after it has been indicated |
Method | _bodyDataReceived_FINISHED | It is invalid for data to be delivered after the response bofdy has |
Method | _bodyDataFinished | Called by HTTPClientParser when no more body data is available. If the |
Method | _bodyDataFinished_INITIAL | Move to the 'DEFERRED_CLOSE' state to wait for a protocol
to |
Method | _bodyDataFinished_CONNECTED | Disconnect the protocol and move to the 'FINISHED'
state. |
Method | _bodyDataFinished_DEFERRED_CLOSE | It is invalid to attempt to notify the Response of the
end of the |
Method | _bodyDataFinished_FINISHED | It is invalid to attempt to notify the Response of the
end of the |
Register an IProtocol
provider to receive the response
body.
The protocol will be connected to a transport which provides
IPushProducer
. The protocol's connectionLost
method will be called with:
reasons
attribute of the exception may provide
more specific indications as to why.
protocol
and prepare to
deliver any future data to it. Move to the 'CONNECTED'
state.protocol
and then disconnect
the protocol. Move to the 'FINISHED'
state.deliverBody
.
Little or no data should be buffered by this method, since the transport has been paused and will not be resumed until a protocol is supplied.
Response
is
connected.'DEFERRED_CLOSE'
state to wait for a protocol
to which to deliver the response body.'FINISHED'
state.