hyper
hyper copied to clipboard
Fix for python 3.7-3.9
This import now works on my python 3.9: from hyper.contrib import HTTP20Adapter
I also needed to: pip install git+https://github.com/python-hyper/hyper-h2.git -U pip install git+https://github.com/python-hyper/hyperframe.git -U
which told me that: ERROR: hyper 0.8.0.dev0 has requirement h2!=2.5.0,<3.0,>=2.4, but you'll have h2 3.2.0 which is incompatible. ERROR: hyper 0.8.0.dev0 has requirement hyperframe<4.0,>=3.2, but you'll have hyperframe 5.2.0 which is incompatible.
But it works now (at least for me):
Python 3.9.0a3+ (heads/master:1b55b65638, Feb 17 2020, 12:08:41)
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> import logging;logging.basicConfig();logging.getLogger().setLevel(logging.DEBUG)
>>> import http.client;http.client.HTTPConnection.debuglevel = 1
>>> s = requests.Session()
>>> r = s.get('https://httpbin.org/get')
...
reply: 'HTTP/1.1 200 OK\r\n'
...
>>> from hyper.contrib import HTTP20Adapter
>>> s.mount('https://', HTTP20Adapter())
>>> r = s.get('https://httpbin.org/get')
DEBUG:hyper.http11.connection:Selected protocol: h2
...
Maybe adding logging will help people in the quickstart to see more than a status code, too.