Opened 12 years ago

Last modified 10 years ago

#4017 enhancement new

— at Add an IBodyProducer which produces bytes from a file-like objectVersion 7

Reported by: Jean-Paul Calderone Owned by:
Priority: normal Milestone:
Component: web Keywords: httpclient IBodyProducer
Cc: Branch: branches/filebodyproducer-4017
branch-diff, diff-cov, branch-cov, buildbot
Author: exarkun

Description (last modified by Jean-Paul Calderone)

#886 introduces an HTTP client API along with a new interface, IBodyProducer, for providing request bodies in a streaming manner. This interface isn't quite the same as IProducer, so existing producers don't quite work with it.

For convenience, we should provide an implementation of this interface based on file-like objects (along the lines of twisted.protocols.basic.FileSender). This will be useful both for the obvious reason (sending files as request bodies), as well as as an example of how to implement these, and will also be usable with StringIO instances to send data constructed in memory (eg simple form posts).

Change History (7)

comment:1 Changed 12 years ago by ivank

Keywords: IBodyProducer added

comment:2 Changed 12 years ago by Jean-Paul Calderone

Keywords: httpclient added

comment:3 Changed 11 years ago by <automation>

Owner: Jean-Paul Calderone deleted

comment:4 Changed 11 years ago by Drew Smathers

Owner: set to Drew Smathers
Status: newassigned

comment:5 Changed 10 years ago by Jean-Paul Calderone

Author: exarkun
Branch: branches/filebodyproducer-4017

(In [32067]) Branching to 'filebodyproducer-4017'

comment:6 Changed 10 years ago by Jean-Paul Calderone

Keywords: review added
Owner: Drew Smathers deleted
Status: assignednew

I took a crack at this because I thought it would be quick and easy. Oh well, I've certainly done worse than none out of two before.

Please find FileBodyProducer, tests, docs, and an example in the linked branch. Here are the build results.

comment:7 Changed 10 years ago by Jean-Paul Calderone

Description: modified (diff)
Summary: Add an IEntityBodyProducer which produces bytes from a file-like objectAdd an IBodyProducer which produces bytes from a file-like object
Note: See TracTickets for help on using tickets.