HTTP/2 Client for Python
.. image:: https://raw.github.com/Lukasa/hyper/development/docs/source/images/hyper.png
.. image:: https://travis-ci.org/Lukasa/hyper.png?branch=master :target: https://travis-ci.org/Lukasa/hyper
HTTP is changing under our feet. HTTP/1.1, our old friend, is being supplemented by the brand new HTTP/2 standard. HTTP/2 provides many benefits: improved speed, lower bandwidth usage, better connection management, and more.
hyper provides these benefits to your Python code. How? Like this::
from hyper import HTTPConnection
conn = HTTPConnection('http2bin.org:443')
conn.request('GET', '/get')
resp = conn.get_response()
print(resp.read())
Simple.
Please be warned: hyper is in a very early alpha. You will encounter bugs
when using it. In addition, there are very many rough edges. With that said,
please try it out in your applications: I need your feedback to fix the bugs
and file down the rough edges.
hyper supports the final draft of the HTTP/2 specification: additionally,
it provides support for drafts 14, 15, and 16 of the HTTP/2 specification. It
also supports the final draft of the HPACK specification.
hyper is intended to be a drop-in replacement for http.client, with a
similar API. However, hyper intentionally does not name its classes the
same way http.client does. This is because most servers do not support
HTTP/2 at this time: I don't want you accidentally using hyper when you
wanted http.client.
Looking to learn more? Documentation for hyper can be found on Read the Docs_.
.. _Read the Docs: http://hyper.readthedocs.io/en/latest/
hyper welcomes contributions from anyone! Unlike many other projects we are
happy to accept cosmetic contributions and small contributions, in addition to
large feature requests and changes.
Before you contribute (either by opening an issue or filing a pull request),
please read the contribution guidelines_.
.. _read the contribution guidelines: http://hyper.readthedocs.org/en/development/contributing.html
hyper is made available under the MIT License. For more details, see the
LICENSE file in the repository.
hyper is maintained by Cory Benfield, with contributions from others. For
more details about the contributors, please see CONTRIBUTORS.rst.
Major Changes
ping method, allowing the user to use the HTTP/2 PING frame
to check connection liveness before, instead of, or between issuing requests.Bugfixes
Bugfixes
Bugfixes
fileno() on the compatibility SSLSocket object
actually work correctly. Thanks to @benlast!Stream class. Thanks to
@fredthomsen!Major Changes
HTTP20Connection object is now thread-safe, so long as stream IDs are
used on all method calls.API Changes
request.HTTP20Connection now has a force_proto keyword argument to allow the
HTTP20Connection to ignore the NPN/ALPN result.--h2 CLI flag now ignores the result of NPN/ALPN negotiation when
hitting HTTPS URLs.Bugfixes
HTTP2-Settings header.Feature Enhancement
Bugfixes
https-schemed URL.--h2 flag to the Hyper CLI tool, which allows straight HTTP/2
in plaintext, rather than attempting to upgrade from HTTP/1.1.get_response.Software Updates
New Features
Issue #28_)HTTP11Connection and HTTPConnection objects are now both context
managers.Issue #31_)Issue #8_)Issue #119_)Issue #15_)Structural Changes
Bugfixes
.. _Issue #8: https://github.com/Lukasa/hyper/issues/8 .. _Issue #15: https://github.com/Lukasa/hyper/issues/15 .. _Issue #28: https://github.com/Lukasa/hyper/issues/28 .. _Issue #31: https://github.com/Lukasa/hyper/issues/31 .. _Issue #119: https://github.com/Lukasa/hyper/issues/119
Bugfixes
ImportError. (Issue #114_).. _Issue #114: https://github.com/Lukasa/hyper/issues/114
New Features
Issue #75_)HTTPHeaderMap data structure that provides dictionary
style lookups while retaining all the semantic information of HTTP headers.Major Changes
Various changes in the HTTP/2 APIs:
getheader, getheaders, gettrailer, and gettrailers
methods on the response object have been removed, replaced instead with
simple .headers and .trailers properties that contain
HTTPHeaderMap structures.iter_chunked() method was added to response objects that allows
iterating over data in units of individual data frames.getresponse() to get_response(), because
getresponse() was a terrible name forced upon me by httplib... _Issue #75: https://github.com/Lukasa/hyper/issues/75
Bugfixes
Issue #110_).. _Issue #110: https://github.com/Lukasa/hyper/issues/110
New Features
hyper command-line client that supports making HTTP/2
requests directly from the command-line.Major Changes
Minor Changes
Major Changes
Minor Changes
Connection header if it's given to us, as that header
is not valid in HTTP/2.Bugfixes
Minor Changes
Bugfixes
AttributeError being raised when a PING frame was received, thanks
to @t2y. (Issue #79_)Issue #80_).. _Issue #79: https://github.com/Lukasa/hyper/issues/79 .. _Issue #80: https://github.com/Lukasa/hyper/issues/80
Regressions and Known Bugs
ssl module. PyOpenSSL has been identified as a
replacement, but until NPN support is merged it cannot be used. Python 3.3
support will be re-added when a suitable release of PyOpenSSL is shipped.For more information on these regressions, please see Issue #37_.
Major Changes
Issue #40_)Issue #56_)nghttp2_ is present, use its HPACK encoder for improved speed and
compression efficiency. (Issue #60_)HTTP20Response.gettrailer() and HTTP20Response.gettrailers(),
supporting downloading and examining HTTP trailers. (Discussed in part in
Issue #71_.)Bugfixes
HTTP20Response objects are context managers. (Issue #24_)Issue #26_)Issue #39_)Issue #41_ and Issue #52_)Issue #27_)Issue #48_)Issue #46_)Issue #50_).. _Issue #24: https://github.com/Lukasa/hyper/issues/24 .. _Issue #26: https://github.com/Lukasa/hyper/issues/26 .. _Issue #27: https://github.com/Lukasa/hyper/issues/27 .. _Issue #33: https://github.com/Lukasa/hyper/issues/33 .. _Issue #37: https://github.com/Lukasa/hyper/issues/37 .. _Issue #39: https://github.com/Lukasa/hyper/issues/39 .. _Issue #40: https://github.com/Lukasa/hyper/issues/40 .. _Issue #41: https://github.com/Lukasa/hyper/issues/41 .. _Issue #46: https://github.com/Lukasa/hyper/issues/46 .. _Issue #48: https://github.com/Lukasa/hyper/issues/48 .. _Issue #50: https://github.com/Lukasa/hyper/issues/50 .. _Issue #52: https://github.com/Lukasa/hyper/issues/52 .. _Issue #56: https://github.com/Lukasa/hyper/issues/56 .. _Issue #60: https://github.com/Lukasa/hyper/issues/60 .. _Issue #71: https://github.com/Lukasa/hyper/issues/71 .. _nghttp2: https://nghttp2.org/
HPACKDecodingError when we're unable to validly map a
Huffman-encoded string.Issue #9_)Issue #13_)HTTP20Adapter correctly reuses connections.Issue #14_).. _Issue #9: https://github.com/Lukasa/hyper/issues/9 .. _Issue #13: https://github.com/Lukasa/hyper/issues/13 .. _Issue #14: https://github.com/Lukasa/hyper/issues/14
Issue #12_)Issue #16_)HTTP20Connection objects are now context managers. (Issue #13_)Issue #20_)Issue #19_)Issue #22_).. _Issue #12: https://github.com/Lukasa/hyper/issues/12 .. _Issue #16: https://github.com/Lukasa/hyper/issues/16 .. _Issue #13: https://github.com/Lukasa/hyper/issues/13 .. _Issue #20: https://github.com/Lukasa/hyper/issues/20 .. _Issue #19: https://github.com/Lukasa/hyper/issues/19 .. _Issue #22: https://github.com/Lukasa/hyper/issues/22