Skip to content
Myr

Documentation for multivalued form-encoded element as a list (#4700)

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

authored by Antti Kaihola · committed by Antti Kaihola · parent 691e952 · Browse files · 1 file+17 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+17 added−0 removed

  • other:+17 added−0 removed

1 file+17 added−0 removed

modified:docs/user/quickstart.rst+17 added
259 unmodified lines
260 },261 ...262 }263264An alternative method to express multiple elements with the same key is to use265a dictionary and list the element values as a list::266267 >>> payload = {'key1': ['value1', 'value2']}268 >>> r = requests.post('http://httpbin.org/post', data=payload)269 >>> print(r.text)270 {271 ...272 "form": {273 "key1": [274 "value1",275 "value2"276 ]277 },278 ...279 }280281There are times that you may want to send data that is not form-encoded. If282you pass in a ``string`` instead of a ``dict``, that data will be posted directly.283284For example, the GitHub API v3 accepts JSON-Encoded POST/PATCH data::
291 unmodified lines