Ian Cordasco changelog.com/posts

Hyper: HTTP/2.0 in Pure Python

The HTTP specification will be changing soon. Our old friend HTTP/1.1 will soon be replaced by HTTP/2.0. The new specification includes a lot of cool new mechanisms and goodies but all previous implementations for HTTP/1.1 will be incapable of handling them.

Hyper is a pure Python implemenation of the current draft (9) of HTTP/2.0’s specification (and draft 5 of the HPACK specification).

As it is now, Hyper can be used as an almost drop-in replacement for Python’s standard library http.client.

Here’s a sample of Hyper’s excellent API:

from hyper import HTTP20Connection

conn = HTTP20Connection('twitter.com:443')
conn.request('GET', '/')
response = conn.getresponse()

print(response.read())

Cory Benfield, Hyper’s author, intends to only support Python 3.3 and beyond. There is a distinctly strong possibility that asyncio will be leveraged when it is released as part of Python 3.4. There is also already an adapter written for requests.


Discussion

Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00