<p dir="auto">In the 0.x versions were 5 hooks:<br>
('args', 'pre_request', 'pre_send', 'post_request', 'response')</p>
<p dir="auto">In 1.x there's only one: response</p>
<p dir="auto">I've seen quite a few packages that used these hooks to manipulate the requests objects before sending them, and now in v1.x there's not even a single hook that allows them to do so.</p>
<p dir="auto">This functionality is very much needed, and without it quite a few packages simple cannot adapt to v1.x, and their alternative is to the <a href="https://github.com/LuminosoInsight/python-requests-transition">sort-of-a-fork requests-transition</a></p>
<p dir="auto">I'm sending a <code class="notranslate">POST</code> request with multiple fields with the same name which normally works well when passed in a <code class="notranslate">dict</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; from requests import post
&gt;&gt;&gt; print post('http://httpbin.org/post', data={'field': ['a', 'b']}).content
{
  &quot;origin&quot;: &quot;[...]&quot;,
  &quot;files&quot;: {},
  &quot;form&quot;: {
    &quot;field&quot;: [
      &quot;a&quot;,
      &quot;b&quot;
    ]
  },
  &quot;url&quot;: &quot;http://httpbin.org/post&quot;,
  &quot;args&quot;: {},
  &quot;headers&quot;: {
    &quot;Content-Length&quot;: &quot;15&quot;,
    &quot;Accept-Encoding&quot;: &quot;identity, deflate, compress, gzip&quot;,
    &quot;Connection&quot;: &quot;keep-alive&quot;,
    &quot;Accept&quot;: &quot;*/*&quot;,
    &quot;User-Agent&quot;: &quot;python-requests/0.13.1&quot;,
    &quot;Host&quot;: &quot;httpbin.org&quot;,
    &quot;Content-Type&quot;: &quot;application/x-www-form-urlencoded&quot;
  },
  &quot;json&quot;: null,
  &quot;data&quot;: &quot;&quot;
}"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; from requests import post
&gt;&gt;&gt; print post('http://httpbin.org/post', data={'field': ['a', 'b']}).content
{
  "origin": "[...]",
  "files": {},
  "form": {
    "field": [
      "a",
      "b"
    ]
  },
  "url": "http://httpbin.org/post",
  "args": {},
  "headers": {
    "Content-Length": "15",
    "Accept-Encoding": "identity, deflate, compress, gzip",
    "Connection": "keep-alive",
    "Accept": "*/*",
    "User-Agent": "python-requests/0.13.1",
    "Host": "httpbin.org",
    "Content-Type": "application/x-www-form-urlencoded"
  },
  "json": null,
  "data": ""
}
</code></pre></div>
<p dir="auto">But fails with a <code class="notranslate">TypeError</code> when the request is a <code class="notranslate">multipart/form-data</code> one:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; print post('http://httpbin.org/post', data={'field': ['a', 'b']}, files={'file': open('/etc/hosts')}).content
Traceback (most recent call last):
  File &quot;&lt;ipython-input-15-4008ff697f5a&gt;&quot;, line 1, in &lt;module&gt;
    print requests.post('http://httpbin.org/post', data={'field': ['a', 'b']}, files={'file': open('/etc/hosts')}).content
  File &quot;python2.7/site-packages/requests/api.py&quot;, line 87, in post
    return request('post', url, data=data, **kwargs)
  File &quot;python2.7/site-packages/requests/safe_mode.py&quot;, line 37, in wrapped
    return function(method, url, **kwargs)
  File &quot;python2.7/site-packages/requests/api.py&quot;, line 42, in request
    return s.request(method=method, url=url, **kwargs)
  File &quot;python2.7/site-packages/requests/sessions.py&quot;, line 230, in request
    r.send(prefetch=prefetch)
  File &quot;python2.7/site-packages/requests/models.py&quot;, line 507, in send
    (body, content_type) = self._encode_files(self.files)
  File &quot;site-packages/requests/models.py&quot;, line 366, in _encode_files
    (body, content_type) = encode_multipart_formdata(fields)
  File &quot;site-packages/requests/packages/urllib3/filepost.py&quot;, line 80, in encode_multipart_formdata
    body.write(data)
TypeError: 'list' does not have the buffer interface"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; print post('http://httpbin.org/post', data={'field': ['a', 'b']}, files={'file': open('/etc/hosts')}).content
Traceback (most recent call last):
  File "&lt;ipython-input-15-4008ff697f5a&gt;", line 1, in &lt;module&gt;
    print requests.post('http://httpbin.org/post', data={'field': ['a', 'b']}, files={'file': open('/etc/hosts')}).content
  File "python2.7/site-packages/requests/api.py", line 87, in post
    return request('post', url, data=data, **kwargs)
  File "python2.7/site-packages/requests/safe_mode.py", line 37, in wrapped
    return function(method, url, **kwargs)
  File "python2.7/site-packages/requests/api.py", line 42, in request
    return s.request(method=method, url=url, **kwargs)
  File "python2.7/site-packages/requests/sessions.py", line 230, in request
    r.send(prefetch=prefetch)
  File "python2.7/site-packages/requests/models.py", line 507, in send
    (body, content_type) = self._encode_files(self.files)
  File "site-packages/requests/models.py", line 366, in _encode_files
    (body, content_type) = encode_multipart_formdata(fields)
  File "site-packages/requests/packages/urllib3/filepost.py", line 80, in encode_multipart_formdata
    body.write(data)
TypeError: 'list' does not have the buffer interface
</code></pre></div>
<p dir="auto">Passing a <code class="notranslate">list</code> of  <code class="notranslate">tuple</code>s doesn't raise an exception but only the last item is included in the request:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; print requests.post('http://httpbin.org/post', data=[('field', 'a'),  ('field', 'b')], files={'file': open('/etc/hosts')}).content
{
  &quot;origin&quot;: &quot;[...]&quot;,
  &quot;files&quot;: {
    &quot;file&quot;: &quot;[...]&quot;
  },
  &quot;form&quot;: {
    &quot;field&quot;: &quot;b&quot;
  },
  &quot;url&quot;: &quot;http://httpbin.org/post&quot;,
  &quot;args&quot;: {},
  &quot;headers&quot;: {
    &quot;Content-Length&quot;: &quot;862&quot;,
    &quot;Accept-Encoding&quot;: &quot;identity, deflate, compress, gzip&quot;,
    &quot;Connection&quot;: &quot;keep-alive&quot;,
    &quot;Accept&quot;: &quot;*/*&quot;,
    &quot;User-Agent&quot;: &quot;python-requests/0.13.1&quot;,
    &quot;Host&quot;: &quot;httpbin.org&quot;,
    &quot;Content-Type&quot;: &quot;multipart/form-data; boundary=127.0.0.1.501.73436.1343139319.461.6&quot;
  },
  &quot;json&quot;: null,
  &quot;data&quot;: &quot;&quot;
}"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; print requests.post('http://httpbin.org/post', data=[('field', 'a'),  ('field', 'b')], files={'file': open('/etc/hosts')}).content
{
  "origin": "[...]",
  "files": {
    "file": "[...]"
  },
  "form": {
    "field": "b"
  },
  "url": "http://httpbin.org/post",
  "args": {},
  "headers": {
    "Content-Length": "862",
    "Accept-Encoding": "identity, deflate, compress, gzip",
    "Connection": "keep-alive",
    "Accept": "*/*",
    "User-Agent": "python-requests/0.13.1",
    "Host": "httpbin.org",
    "Content-Type": "multipart/form-data; boundary=127.0.0.1.501.73436.1343139319.461.6"
  },
  "json": null,
  "data": ""
}
</code></pre></div>