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

class documentation

`class Request: (source)`

Implements interfaces: `twisted.web.iweb.IClientRequest`

View In Hierarchy

A `Request` instance describes an HTTP request to be sent to an HTTP server.

Method | `__init__` | No summary
Method | `stopWriting` | Stop writing this request to the transport. This can only be called after `writeTo` and before the `Deferred` returned by `writeTo` fires. It should cancel any asynchronous task started by `writeTo`. The `Deferred`...
Method | `writeTo` | Format this `Request` as an HTTP/1.1 request and write it to the given transport. If bodyProducer is not None, it will be associated with an `IConsumer`.
Instance Variable | `bodyProducer` | See `__init__`.
Instance Variable | `headers` | See `__init__`.
Instance Variable | `method` | See `__init__`.
Instance Variable | `persistent` | See `__init__`.
Instance Variable | `uri` | See `__init__`.
Property | `absoluteURI` | The absolute URI of the request as `bytes`, or `None` if the absolute URI cannot be determined.
Class Method | `_construct` | Private constructor.
Method | `_writeHeaders` | Undocumented
Method | `_writeToBodyProducerChunked` | Write this request to the given transport using chunked transfer-encoding to frame the body.
Method | `_writeToBodyProducerContentLength` | Write this request to the given transport using content-length to frame the body.
Method | `_writeToEmptyBodyContentLength` | Write this request to the given transport using content-length to frame the (empty) body.
Class Variable | `_log` | Undocumented
Instance Variable | `_parsedURI` | Parsed URI for the request, or `None`.

def __init__(self, method, uri, headers, bodyProducer, persistent=False): (source)

Parameters
method:`bytes` | The HTTP method for this request, ex: b'GET', b'HEAD', b'POST', etc.
uri:`bytes` | The relative URI of the resource to request. For example, `b'/foo/bar?baz=quux'`.
headers:`twisted.web.http_headers.Headers` | Headers to be sent to the server. It is important to note that this object does not create any implicit headers. So it is up to the HTTP Client to add required headers such as 'Host'.
bodyProducer | `None` or an `IBodyProducer` provider which produces the content body to send to the remote HTTP server.
persistent:`bool` | Set to `True` when you use HTTP persistent connection, defaults to `False`.

def stopWriting(self): (source)

Stop writing this request to the transport. This can only be called after `writeTo` and before the `Deferred` returned by `writeTo` fires. It should cancel any asynchronous task started by `writeTo`. The `Deferred` returned by `writeTo` need not be fired if this method is called.

def writeTo(self, transport): (source)

Format this `Request` as an HTTP/1.1 request and write it to the given transport. If bodyProducer is not None, it will be associated with an `IConsumer`.

Parameters
transport:`twisted.internet.interfaces.ITransport` provider | The transport to which to write.
Returns
A `Deferred` which fires with `None` when the request has been completely written to the transport or with a `Failure` if there is any problem generating the request bytes.

bodyProducer = (source)

See `__init__`.

headers = (source)
from `twisted.web.iweb.IClientRequest`

See `__init__`.

method = (source)
from `twisted.web.iweb.IClientRequest`

See `__init__`.

persistent = (source)

See `__init__`.

uri = (source)

See `__init__`.

@property
absoluteURI = (source)
from `twisted.web.iweb.IClientRequest`

The absolute URI of the request as `bytes`, or `None` if the absolute URI cannot be determined.

@classmethod
def _construct(cls, method, uri, headers, bodyProducer, persistent=False, parsedURI=None): (source)

Private constructor.

Parameters
method | See `__init__`.
uri | See `__init__`.
headers | See `__init__`.
bodyProducer | See `__init__`.
persistent | See `__init__`.
parsedURI | See `Request._parsedURI`.
Returns
`Request` instance.

def _writeHeaders(self, transport, TEorCL): (source)

Undocumented

def _writeToBodyProducerChunked(self, transport): (source)

Write this request to the given transport using chunked transfer-encoding to frame the body.

Parameters
transport | See `writeTo`.
Returns
See `writeTo`.

def _writeToBodyProducerContentLength(self, transport): (source)

Write this request to the given transport using content-length to frame the body.

Parameters
transport | See `writeTo`.
Returns
See `writeTo`.

def _writeToEmptyBodyContentLength(self, transport): (source)

Write this request to the given transport using content-length to frame the (empty) body.

Parameters
transport | See `writeTo`.
Returns
See `writeTo`.

_log = (source)

Undocumented

_parsedURI: `twisted.web.client.URI` or `None` = (source)

Parsed URI for the request, or `None`.