bdarnell / tornado_http2

Apache License 2.0
78 stars 17 forks source link

tornado_http2

This package contains an HTTP/2 client and server implementation for Tornado. It is currently under development and interfaces are subject to change.

Installation

pip install git+https://github.com/bdarnell/tornado_http2.git

This package has only been tested with Tornado 4.5 on Python 2.7.10+ and 3.5.

Server-side usage

Two server classes are provided:

Both server classes can be used in two different ways: either instantiate them directly in place of a tornado.httpserver.HTTPServer:

server = tornado_http2.server.Server(app, ssl_options=...)
server.listen(...)

Or use HTTPServer.configure to change all HTTPServers in the process, including those created by methods like Application.listen or AsyncHTTPTestCase:

tornado.httpserver.HTTPServer.configure('tornado_http2.server.Server')
app.listen(...)

Client-side usage

Three client classes are provided:

Both client classes can be used in two different ways: either instantiate them directly in place of a tornado.httpclient.AsyncHTTPClient (be careful with AsyncHTTPClient's instance-sharing magic):

client = tornado_http2.client.Client(force_instance=True)

Or use AsyncHTTPClient.configure to change all AsyncHTTPClients in the process:

tornado.httpclient.AsyncHTTPClient.configure('tornado_http2.client.Client')