Skip to content
Myr

Merge pull request #2506 from Lukasa/chunkeddocs

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

Expand on chunked handling.

authored by Ian Cordasco · committed by Ian Cordasco · parents 0be38a0, 2b5cdc5 · Browse files · 1 file+7 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+7 added−1 removed

  • other:+7 added−1 removed

1 file+7 added−1 removed

modified:docs/user/advanced.rst+7 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``. If you want to set a maximum size of the chunk,282you can set a chunk size parameter to any integer.283284285.. _multipart:286287POST Multiple Multipart-Encoded Files288-------------------------------------
543 unmodified lines