Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`web`.`iweb`.`IResponse``

interface documentation

`class IResponse(Interface): (source)`

Known implementations: `twisted.web.client.Response`

View In Hierarchy

An object representing an HTTP response received from an HTTP server.

Present Since
11.1

Method | `deliverBody` | Register an `IProtocol` provider to receive the response body.
Method | `setPreviousResponse` | Set the reference to the previous `IResponse`.
Attribute | `code` | The HTTP status code of this response, as a `int`.
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 ...
Attribute | `phrase` | The HTTP reason phrase of this response, as a `str`.
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.
Attribute | `request` | The `IClientRequest` that resulted in this response.
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, `(b'HTTP', 1, 1)`.

def deliverBody(protocol): (source)

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:

- ResponseDone, which indicates that all bytes from the response have been successfully delivered.
- PotentialDataLoss, which indicates that it cannot be determined if the entire response body has been delivered. This only occurs when making requests to HTTP servers which do not set Content-Length or a Transfer-Encoding in the response.
- ResponseFailed, which indicates that some bytes from the response were lost. The `reasons` attribute of the exception may provide more specific indications as to why.

def setPreviousResponse(response): (source)

Set the reference to the previous `IResponse`.

The value of the previous response can be read via `IResponse.previousResponse`.

code = (source)

The HTTP status code of this response, as a `int`.

headers = (source)

The HTTP response `Headers` of this response.

length = (source)

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`.

phrase = (source)

The HTTP reason phrase of this response, as a `str`.

previousResponse = (source)

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.

request = (source)

The `IClientRequest` that resulted in this response.

version = (source)

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, `(b'HTTP', 1, 1)`.