python-hyper / hyper

HTTP/2 for Python.
http://hyper.rtfd.org/en/latest/
MIT License
1.05k stars 191 forks source link

hyper.contrib.HTTP20Adapter with requests.session not working on python 2.7 #419

Open ramazk opened 4 years ago

ramazk commented 4 years ago
Python 2.7.10 (default, Oct  6 2017, 22:29:07) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> from hyper.contrib import HTTP20Adapter
>>> s = requests.Session()
>>> s.mount('https://http2.pro', HTTP20Adapter())
>>> s.get('https://http2.pro/api/v1').json()
{u'push': 0, u'protocol': u'HTTP/1.1', u'user_agent': u'python-requests/2.22.0', u'http2': 0}

On python3 same code shows: {'http2': 1, 'protocol': 'HTTP/2.0', 'push': 0, 'user_agent': 'python-requests/2.22.0'}