Known implementations: twisted.web.client.FileBodyProducer, twisted.web.test.test_newclient.StringProducer

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 Since9.0
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.
Method startProducing Start producing to the given IConsumer provider.
Method stopProducing No summary

Inherited from IPushProducer:

Method pauseProducing Pause producing data.
Method resumeProducing Resume producing data.
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.

def startProducing(consumer):

Start producing to the given IConsumer provider.

ReturnsA 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():

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

API Documentation for twisted, generated by pydoctor at 2020-03-25 17:34:30.