title: Python hyper force HTTP/2 when using requests
body: <p>I'm trying to use <code>hyper.contrib</code> <code>HTTP20Adapter</code> with the <code>requests</code> module as described <a href="https://hyper.readthedocs.io/en/latest/quickstart.html" rel="nofollow noreferrer">here</a>, but even with following the example for using HTTP/2 in this way, it still uses HTTP/1.1.  This results in <code>ConnectionResetError</code> and HTTP/2 is never attempted.  If I use <code>hyper HTTPConnection</code>, it also uses HTTP/1.1 and fails.  But if I use <code>HTTP20Connection</code>, it uses HTTP/2 and succeeds.  Is there a way to force <code>requests</code> with the <code>HTTP20Adapter</code> to use only HTTP/2?</p>
  <p>First test, using <code>HTTPConnection</code>.  A wireshark trace confirms that this resulted in an HTTP/1.1 GET and a Connection Reset.</p>
  <pre><code>&gt;&gt;&gt; from hyper import HTTPConnection
  &gt;&gt;&gt; c = HTTPConnection('10.11.22.33:8080')
  &gt;&gt;&gt; c.request('GET', '/my/path/')
  &gt;&gt;&gt; resp = c.get_response()
  Traceback (most recent call last):
    File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
    File &quot;/root/Python/myApp/lib64/python3.6/site-packages/hyper/common/connection.py&quot;, line 129, in get_response
      return self._conn.get_response(*args, **kwargs)
    File &quot;/root/Python/myApp/lib64/python3.6/site-packages/hyper/http11/connection.py&quot;, line 203, in get_response
      self._sock.fill()
    File &quot;/root/Python/myApp/lib64/python3.6/site-packages/hyper/common/bufsocket.py&quot;, line 169, in fill
      raise ConnectionResetError()
  ConnectionResetError
  </code></pre>
  <p>Second test, using <code>HTTP20Connection</code>.  This resulted in an HTTP/2 GET request and a successful response.</p>
  <pre><code>&gt;&gt;&gt; from hyper import HTTP20Connection
  &gt;&gt;&gt; c = HTTP20Connection('10.11.22.33:8080')
  &gt;&gt;&gt; c.request('GET', '/my/path/')
  1
  &gt;&gt;&gt; resp = c.get_response()
  &gt;&gt;&gt; print(resp.headers)
  HTTPHeaderMap([(b'server', b'nginx/1.14.1'), (b'date', b'Wed, 12 Aug 2020 13:29:34 GMT'), (b'content-type', b'application/problem+json'), (b'3gpp-sbi-message-priority', b'10'), (b'x-envoy-upstream-service-time', b'109')])
  </code></pre>
  <p>Third test, using <code>requests</code> with an adapter.  This also resulted in an HTTP/1.1 request and  <code>ConnectionResetError</code>.  HTTP/2 was not seen over the wire.</p>
  <pre><code>&gt;&gt;&gt; import requests
  &gt;&gt;&gt; from hyper.contrib import HTTP20Adapter
  &gt;&gt;&gt; 
  &gt;&gt;&gt; s = requests.Session()
  &gt;&gt;&gt; s.mount('http://10.11.22.33:8080', HTTP20Adapter())
  &gt;&gt;&gt; s
  &lt;requests.sessions.Session object at 0x7f68f3487f28&gt;
  &gt;&gt;&gt; 
  &gt;&gt;&gt; 
  &gt;&gt;&gt; r = s.get('http://10.11.22.33:8080/my/path/')
  Traceback (most recent call last):
    File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
    File &quot;/root/Python/myApp/lib64/python3.6/site-packages/requests/sessions.py&quot;, line 543, in get
      return self.request('GET', url, **kwargs)
    File &quot;/root/Python/myApp/lib64/python3.6/site-packages/requests/sessions.py&quot;, line 530, in request
      resp = self.send(prep, **send_kwargs)
    File &quot;/root/Python/myApp/lib64/python3.6/site-packages/requests/sessions.py&quot;, line 643, in send
      r = adapter.send(request, **kwargs)
    File &quot;/root/Python/myApp/lib64/python3.6/site-packages/hyper/contrib.py&quot;, line 80, in send
      resp = conn.get_response()
    File &quot;/root/Python/myApp/lib64/python3.6/site-packages/hyper/common/connection.py&quot;, line 129, in get_response
      return self._conn.get_response(*args, **kwargs)
    File &quot;/root/Python/myApp/lib64/python3.6/site-packages/hyper/http11/connection.py&quot;, line 203, in get_response
      self._sock.fill()
    File &quot;/root/Python/myApp/lib64/python3.6/site-packages/hyper/common/bufsocket.py&quot;, line 169, in fill
      raise ConnectionResetError()
  ConnectionResetError
  </code></pre>
  <p>I really need to get this last test working, as the rest of my framework is using the <code>requests</code> module.</p>