Hyper: HTTP/2 Client for Python
Hyper is a Python library designed to provide an HTTP/2 client. While it aimed to offer benefits like improved speed and lower bandwidth usage, the project is no longer maintained. The current and final version is 0.7.0, and there is no ongoing release cadence.
Warnings
- breaking The `hyper` project is officially unmaintained. No further updates will be published, and potential security issues will not be addressed. It is strongly recommended to use actively maintained alternatives like `HTTPX` for new projects.
- gotcha The library was considered 'early alpha' even at version 0.7.0, with a warning that users would encounter bugs and 'many rough edges'. Expect unstable behavior and potential issues.
- breaking Version 0.6.0 significantly changed the HTTP/2 state machine logic by replacing it with `hyper-h2`. This 'dramatically changed the behaviour of the library' and was noted to likely introduce new bugs.
- gotcha For Python versions older than 3.4 (or 2.7.9), `hyper` relies on `PyOpenSSL` for modern TLS support. Installing `PyOpenSSL` may require building it against OpenSSL 1.0.1 or later, which can be non-trivial. Follow `cryptography` project's OpenSSL installation instructions, replacing references to `cryptography` with `hyper`.
Install
-
pip install hyper
Imports
- HTTPConnection
from hyper import HTTPConnection
- HTTPSConnection
from hyper import HTTPSConnection
Quickstart
from hyper import HTTPConnection
conn = HTTPConnection('http2bin.org:443')
conn.request('GET', '/get')
resp = conn.get_response()
print(resp.read().decode('utf-8'))