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

interface documentation

`class IBodyProducer(IPushProducer): (source)`

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

View In Hierarchy

Objects which provide `IBodyProducer` write bytes to an object which provides `IConsumer` by calling its `write` method repeatedly.

`IBodyProducer` providers may start producing as soon as they have an `IConsumer` provider. That is, they should not wait for a `resumeProducing` call to begin writing data.

`IConsumer.unregisterProducer` must not be called. Instead, the `Deferred` returned from `startProducing` must be fired when all bytes have been written.

`IConsumer.write` may synchronously invoke any of `pauseProducing`, `resumeProducing`, or `stopProducing`. These methods must be implemented with this in mind.

Present Since
9.0

Method | `startProducing` | Start producing to the given `IConsumer` provider.
Method | `stopProducing` | In addition to the standard behavior of `IProducer.stopProducing` (stop producing data), make sure the `Deferred` returned by `startProducing` is never fired.
Attribute | `length` | `length` is a `int` indicating how many bytes in total this `IBodyProducer` will write to the consumer or `UNKNOWN_LENGTH` if this is not known in advance.

Inherited from `IPushProducer`:

Method | `pauseProducing` | Pause producing data.
Method | `resumeProducing` | Resume producing data.

def startProducing(consumer): (source)

Start producing to the given `IConsumer` provider.

Returns
A `Deferred` which stops production of data when `Deferred.cancel` is called, and which fires with `None` when all bytes have been produced or with a `Failure` if there is any problem before all bytes have been produced.

def stopProducing(): (source)
overrides `twisted.internet.interfaces.IProducer.stopProducing`

In addition to the standard behavior of `IProducer.stopProducing` (stop producing data), make sure the `Deferred` returned by `startProducing` is never fired.

length = (source)

`length` is a `int` indicating how many bytes in total this `IBodyProducer` will write to the consumer or `UNKNOWN_LENGTH` if this is not known in advance.