<p dir="auto"></p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/psf/requests/blob/1e62a3ec18e19f85ddae03b4cbbdf0b4c62834c0/setup.cfg#L6-L10">requests/setup.cfg</a>
    </p>
    <p class="mb-0 color-fg-muted">
        Lines 6 to 10
      in
      <a data-pjax="true" class="commit-tease-sha" href="/psf/requests/commit/1e62a3ec18e19f85ddae03b4cbbdf0b4c62834c0">1e62a3e</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L6" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="6"></td>
          <td id="LC6" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">requires-dist</span> = </td>
        </tr>

        <tr class="border-0">
          <td id="L7" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="7"></td>
          <td id="LC7" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     certifi&gt;=2017.4.17 </td>
        </tr>

        <tr class="border-0">
          <td id="L8" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="8"></td>
          <td id="LC8" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     charset_normalizer&gt;=2,&lt;4 </td>
        </tr>

        <tr class="border-0">
          <td id="L9" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="9"></td>
          <td id="LC9" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     idna&gt;=2.5,&lt;4 </td>
        </tr>

        <tr class="border-0">
          <td id="L10" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="10"></td>
          <td id="LC10" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     urllib3&gt;=1.21.1,&lt;1.27 </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<h2 dir="auto">Problem statement</h2>
<p dir="auto">Current documentation only specifies the most common case of post data - a dictionary. The code in fact supports other forms of post data which is not documented. Propose to enhance the quick start section that deals with post data to include examples of other uses.</p>
<p dir="auto">Section of text in the current documentation: <a href="http://docs.python-requests.org/en/master/user/quickstart/#more-complicated-post-requests" rel="nofollow">More complicated POST requests</a></p>
<h2 dir="auto">Questions in the wild indicating the need for more documentation in this regard</h2>
<p dir="auto">On stockoverflow:</p>
<ul dir="auto">
<li><a href="http://stackoverflow.com/questions/23384230/how-to-post-multiple-value-with-same-key-in-python-requests" rel="nofollow">how to post multiple value with same key in python requests?</a></li>
<li><a href="http://stackoverflow.com/questions/27116424/handling-duplicate-keys-in-http-post-in-order-to-specify-multiple-values" rel="nofollow">handling duplicate keys in HTTP post in order to specify multiple values</a></li>
<li><a href="http://stackoverflow.com/questions/19004403/how-to-send-multiple-of-the-same-key-parameter-via-post" rel="nofollow">How to send multiple of the same key/parameter via POST?</a></li>
<li><a href="http://stackoverflow.com/questions/31168819/how-to-send-an-array-using-requests-post-python-value-error-too-many-values/35534695" rel="nofollow">How to send an array using requests.post (Python)? “Value Error: Too many values to unpack”</a></li>
</ul>
<p dir="auto">And there is this issue <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="20380137" data-permission-text="Title is private" data-url="https://github.com/psf/requests/issues/1641" data-hovercard-type="issue" data-hovercard-url="/psf/requests/issues/1641/hovercard" href="https://github.com/psf/requests/issues/1641">#1641</a>: Cannot send Single Key, Multiple value data in post because of the use of pythons dict.</p>
<h2 dir="auto">Proposed modification:</h2>
<div class="highlight highlight-text-restructuredtext notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="You can also pass a list of tuples to the ``data`` argument. This is particularly
useful when the form has multiple elements that use the same key::

    &gt;&gt;&gt; payload = (('key1', 'value1'), ('key1', 'value2'))
    &gt;&gt;&gt; r = requests.post('http://httpbin.org/post', data=payload)
    &gt;&gt;&gt; print(r.text)
    {
      ...
      &quot;form&quot;: {
        &quot;key1&quot;: [
          &quot;value1&quot;,
          &quot;value2&quot;
        ]
      },
      ...
    }

Value of each payload element can be a scalar or an iterable::

    &gt;&gt;&gt; payload = (('key1', ('value1', 1, (1, 2))), {'key2', ('value2', 2)})
    &gt;&gt;&gt; r = requests.post('http://httpbin.org/post', data=payload)
    &gt;&gt;&gt; print(r.text)
    {
      ...
      &quot;form&quot;: {
        &quot;key1&quot;: [
          &quot;value1&quot;,
          &quot;1&quot;,
          &quot;1&quot;,
          &quot;2&quot;
        ],
        &quot;key2&quot;: [
          &quot;value2&quot;,
          &quot;2&quot;
        ]
      },
      ...
    }
"><pre class="notranslate">You can also pass a list of tuples to the ``<span class="pl-c1">data</span>`` argument. This is particularly
useful when the form has multiple elements that use the same key::

<span class="pl-c1">    &gt;&gt;&gt; payload = (('key1', 'value1'), ('key1', 'value2'))</span>
<span class="pl-c1">    &gt;&gt;&gt; r = requests.post('http://httpbin.org/post', data=payload)</span>
<span class="pl-c1">    &gt;&gt;&gt; print(r.text)</span>
<span class="pl-c1">    {</span>
<span class="pl-c1">      ...</span>
<span class="pl-c1">      "form": {</span>
<span class="pl-c1">        "key1": [</span>
<span class="pl-c1">          "value1",</span>
<span class="pl-c1">          "value2"</span>
<span class="pl-c1">        ]</span>
<span class="pl-c1">      },</span>
<span class="pl-c1">      ...</span>
<span class="pl-c1">    }</span>

Value of each payload element can be a scalar or an iterable::

<span class="pl-c1">    &gt;&gt;&gt; payload = (('key1', ('value1', 1, (1, 2))), {'key2', ('value2', 2)})</span>
<span class="pl-c1">    &gt;&gt;&gt; r = requests.post('http://httpbin.org/post', data=payload)</span>
<span class="pl-c1">    &gt;&gt;&gt; print(r.text)</span>
<span class="pl-c1">    {</span>
<span class="pl-c1">      ...</span>
<span class="pl-c1">      "form": {</span>
<span class="pl-c1">        "key1": [</span>
<span class="pl-c1">          "value1",</span>
<span class="pl-c1">          "1",</span>
<span class="pl-c1">          "1",</span>
<span class="pl-c1">          "2"</span>
<span class="pl-c1">        ],</span>
<span class="pl-c1">        "key2": [</span>
<span class="pl-c1">          "value2",</span>
<span class="pl-c1">          "2"</span>
<span class="pl-c1">        ]</span>
<span class="pl-c1">      },</span>
<span class="pl-c1">      ...</span>
<span class="pl-c1">    }</span>
</pre></div>