|
1 |
| -================================== |
2 |
| -Hyper: HTTP Abstraction for Python |
3 |
| -================================== |
| 1 | +========================== |
| 2 | +Hyper: HTTP/2.0 for Python |
| 3 | +========================== |
4 | 4 |
|
5 | 5 | HTTP is changing under our feet. HTTP/1.1, our old friend, is being
|
6 | 6 | supplemented by the brand new HTTP/2.0 standard. HTTP/2.0 provides many
|
7 | 7 | benefits: improved speed, lower bandwidth usage, better connection management,
|
8 | 8 | and more.
|
9 | 9 |
|
10 |
| -Unfortunately, most web servers do not support HTTP/2.0 at this time. What's |
11 |
| -needed is to abstract the difference between HTTP/1.1 and HTTP/2.0, so that |
12 |
| -your application can reap the benefits of HTTP/2.0 when possible whilst |
13 |
| -maintaining maximum compatibility. |
| 10 | +``hyper`` provides these benefits to your Python code. How? Like this:: |
14 | 11 |
|
15 |
| -Enter ``hyper``:: |
| 12 | + from hyper import HTTP20Connection |
16 | 13 |
|
17 |
| - from hyper import HTTPConnection |
| 14 | + conn = HTTP20Connection('twitter.com:443') |
| 15 | + conn.request('GET', '/') |
| 16 | + resp = conn.getresponse() |
18 | 17 |
|
19 |
| - conn = HTTPConnection("www.python.org") |
20 |
| - conn.request("GET", "/index.html") |
| 18 | + print(resp.read()) |
21 | 19 |
|
22 |
| - r1 = conn.getresponse() |
| 20 | +Simple. |
23 | 21 |
|
24 |
| -Did that code use HTTP/1.1, or HTTP/2.0? You don't have to worry. Whatever |
25 |
| -``www.python.org`` supports, ``hyper`` will use. |
| 22 | +Caveat Emptor! |
| 23 | +============== |
| 24 | + |
| 25 | +Please be warned: ``hyper`` is in a very early alpha. You _will_ encounter bugs |
| 26 | +when using it. In addition, there are very many rough edges. With that said, |
| 27 | +please try it out in your applications: I need your feedback to fix the bugs |
| 28 | +and file down the rough edges. |
| 29 | + |
| 30 | +Versions |
| 31 | +======== |
| 32 | + |
| 33 | +``hyper`` provides support for draft 9 of the HTTP/2.0 draft specification and |
| 34 | +draft 5 of the HPACK draft specification. As further drafts are released, |
| 35 | +``hyper`` will be updated to support them. |
26 | 36 |
|
27 | 37 | Compatibility
|
28 | 38 | =============
|
29 | 39 |
|
30 |
| -``hyper`` is intended to be a drop-in replacement for |
31 |
| -``httplib``/``http.client``, with an identical API. You can get all of the |
32 |
| -HTTP/2.0 goodness by simply replacing your ``import httplib`` or |
33 |
| -``import http.client`` line with ``import hyper as httplib`` or ``import hyper |
34 |
| -as http.client``. You should then be good to go. |
| 40 | +``hyper`` is intended to be a drop-in replacement for ``http.client``, with a |
| 41 | +similar API. However, ``hyper`` intentionally does not name its classes the |
| 42 | +same way ``http.client`` does. This is because most servers do not support |
| 43 | +HTTP/2.0 at this time: I don't want you accidentally using ``hyper`` when you |
| 44 | +wanted ``http.client``. |
35 | 45 |
|
36 | 46 | Contributing
|
37 | 47 | ============
|
|
0 commit comments