twisted.web.iweb.IResponse(Interface)
interface documentationtwisted.web.iweb
View Source
(View In Hierarchy)
Known implementations: twisted.web.client.Response
An object representing an HTTP response received from an HTTP server.
Present Since | 11.1 |
Attribute | 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) . |
Attribute | code | The HTTP status code of this response, as a int . |
Attribute | phrase | The HTTP reason phrase of this response, as a str . |
Attribute | headers | The HTTP response Headers of
this response. |
Attribute | length | The int 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 . |
Attribute | request | The IClientRequest
that resulted in this response. |
Attribute | previousResponse | The previous IResponse from a
redirect, or None if there was no previous response. This can
be used to walk the response or request history for redirections. |
Method | deliverBody | Register an IProtocol
provider to receive the response body. |
Method | setPreviousResponse | Set the reference to the previous IResponse . |
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)
.
The int
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
.
The previous IResponse
from a
redirect, or None
if there was no previous response. This can
be used to walk the response or request history for redirections.
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.
Set the reference to the previous IResponse
.
The value of the previous response can be read via IResponse.previousResponse
.