Skip to content
Myr

Add warnings about text/binary mode files.

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 18a6b60 · Browse files · 2 files+27 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

2 files+27 added−1 removed

  • other:+27 added−1 removed

2 files+27 added−1 removed

modified:docs/user/advanced.rst+19 added-1 removed
313 unmodified lines
314315 with open('massive-body', 'rb') as f:316 requests.post('http://some.url/streamed', data=f)317318.. warning:: It is strongly recommended that you open files in `binary mode`_.319 This is because Requests may attempt to provide the320 ``Content-Length`` header for you, and if it does this value will321 be set to the number of *bytes* in the file. Errors may occur if322 you open the file in *text mode*.323324.. _binary mode: https://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files325326327.. _chunk-encoding:328329Chunk-Encoded Requests330----------------------
39 unmodified lines
370 'Content-Type': 'multipart/form-data; boundary=3131623adb2043caaeb5538cc7aa0b3a',371 ...372 }373374.. warning:: It is strongly recommended that you open files in `binary mode`_.375 This is because Requests may attempt to provide the376 ``Content-Length`` header for you, and if it does this value will377 be set to the number of *bytes* in the file. Errors may occur if378 you open the file in *text mode*.379380.. _binary mode: https://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files381382383.. _event-hooks:384385Event Hooks386-----------
149 unmodified lines
536 "http://10.20.1.128": "http://10.10.1.10:5323",537 }538539Note that proxy URLs must include the scheme.522 540541.. _compliance:542543Compliance544----------
351 unmodified lines
modified:docs/user/quickstart.rst+8 added
300 unmodified lines
301302For sending multiple files in one request refer to the :ref:`advanced <advanced>`303section.304305.. warning:: It is strongly recommended that you open files in `binary mode`_.306 This is because Requests may attempt to provide the307 ``Content-Length`` header for you, and if it does this value will308 be set to the number of *bytes* in the file. Errors may occur if309 you open the file in *text mode*.310311.. _binary mode: https://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files312313314Response Status Codes315---------------------316317We can check the response status code::
177 unmodified lines