Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ Patches and Suggestions

- Chris van Marle (https://github.com/qistoph)

- Florence Blanc-Renaud <flo@redhat.com> (@flo-renaud)
- Florence Blanc-Renaud <flo@redhat.com> (@flo-renaud)
- lexingtonhibiki (https://github.com/lexingtonhibiki)
26 changes: 14 additions & 12 deletions requests_toolbelt/multipart/encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,20 @@ class MultipartEncoder(object):
{'X-My-Header': 'my-value'})
])

.. warning::

This object will end up directly in :mod:`httplib`. Currently,
:mod:`httplib` has a hard-coded read size of **8192 bytes**. This
means that it will loop until the file has been read and your upload
could take a while. This is **not** a bug in requests. A feature is
being considered for this object to allow you, the user, to specify
what size should be returned on a read. If you have opinions on this,
please weigh in on `this issue`_.

.. _this issue:
https://github.com/requests/toolbelt/issues/75
.. note::

The HTTP transport used by requests determines how many bytes to
request from the encoder on each read. The read size depends on the
transport's version and configuration; it is not fixed by this
encoder. For example, Python 3.7 added a ``blocksize`` parameter to
`http.client.HTTPConnection`_, and urllib3 exposes its own
`HTTPConnection configuration`_. The toolbelt does not create these
connections or provide an encoder option to configure their read size.

.. _http.client.HTTPConnection:
https://docs.python.org/3/library/http.client.html#http.client.HTTPConnection
.. _HTTPConnection configuration:
https://urllib3.readthedocs.io/en/stable/reference/urllib3.connection.html

"""

Expand Down