Skip to content
Myr

Expand on chunked handling.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Cory Benfield · committed by Cory Benfield · parent 86f9b16 · Browse files · 1 file+6 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−1 removed

  • other:+6 added−1 removed

1 file+6 added−1 removed

modified:docs/user/advanced.rst+6 added-1 removed
266 unmodified lines
267Requests also supports Chunked transfer encoding for outgoing and incoming requests.268To send a chunk-encoded request, simply provide a generator (or any iterator without269a length) for your body::270271271 def gen():272 yield 'hi'273 yield 'there'274275 requests.post('http://some.url/chunked', data=gen())276277For chunked encoded responses, it's best to iterate over the data using278:meth:`Response.iter_content() <requests.models.Response.iter_content>`. In279an ideal situation you'll have set ``stream=True`` on the request, in which280case you can iterate chunk-by-chunk by calling ``iter_content`` with a chunk281size parameter of ``None``.282283284.. _multipart:285286POST Multiple Multipart-Encoded Files287-------------------------------------
529 unmodified lines