Skip to content
Myr

Merge pull request #2724 from smiley/master

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

Add documentation in "More complicated POST requests" (Quickstart) to resolve #2686

authored by Cory Benfield · committed by Cory Benfield · parents 408d75d, b1de7e7 · Browse files · 1 file+9 added−0 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+9 added−0 removed

  • other:+9 added−0 removed

1 file+9 added−0 removed

modified:docs/user/quickstart.rst+9 added
226 unmodified lines
227 >>> url = 'https://api.github.com/some/endpoint'228 >>> payload = {'some': 'data'}229230 >>> r = requests.post(url, data=json.dumps(payload))231 232Instead of encoding the ``dict`` yourself, you can also pass it directly using233the ``json`` parameter (added in version 2.4.2) and it will be encoded automatically:234235 >>> import json236 >>> url = 'https://api.github.com/some/endpoint'237 >>> payload = {'some': 'data'}238239 >>> r = requests.post(url, json=payload)240241242POST a Multipart-Encoded File243-----------------------------244245Requests makes it simple to upload Multipart-encoded files::
235 unmodified lines