Code Monkey home page Code Monkey logo

http2's Introduction

http2

HTTP/2 client for tornado

Features

  • connect_timeout & request_timeout supporting
  • push streams
  • h2 & h2c supporting
  • auto-reconnect to server with back-off
  • stream multiplexing
  • stream concurrency negotiating
  • SNI supporting in tornado2
  • gzip supporting

Non-features

  • web server, dispatcher, cookie, etc
  • HTTP/2 upgrade
  • follow redirections

WIP

  • RST_STREAM in body producer
  • RST_STREAM after timeout
  • close client connection
  • pushed streams as future
  • healthy check
  • flow window manager
  • support HTTPRequest.body_producer

Dependencies

  • h2>=2.1.0
  • tornado>=4.0 or tornado==2.4.1
  • CPython>=2.7.10 (not required for h2c, as secure=False)
  • certifi for tornado==2.4.1
  • backports.ssl_match_hostname for tornado==2.4.1

Example Usage

import tornado.ioloop
from tornado.httpclient import HTTPRequest

from http2 import SimpleAsyncHTTP2Client

client = SimpleAsyncHTTP2Client(
    host='h2o.examp1e.net', enable_push=True,
    connect_timeout=1, defaults={'request_timeout': 1}
)

resp = tornado.ioloop.IOLoop.instance().run_sync(lambda: client.fetch('/'))

print resp
for pushed_response in resp.pushed_responses:
    print pushed_response.effective_url

Credits

A big thanks to the great library hyper-h2 from Cory Benfield. :P

http2's People

Contributors

boyxuper avatar leohowell avatar

Watchers

shajiquan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.