Skip to main content

HTTP/2 Async Client written with h2, for tornado

Project description

Async HTTP/2 Client

A simple asynchronous HTTP/2 client for Tornado applications, based on the awesome h2 library.

Intended for Python 2 (>= 2.7.9).

This package is in a very early development stage, so expect bugs or changes in the API. If you spot anything wrong, or would like to suggest improvements, please open an issue or a pull request.

Example

Usage in a coroutine may be:

from th2c import AsyncHTTP2Client
from tornado.httpclient import HTTPRequest

client = AsyncHTTP2Client(
    host='nghttp2.org', port=443, secure=True,
)

request = HTTPRequest(
    url='https://nghttp2.org/httpbin/get',
    method='GET',
)

res = yield client.fetch(request)

TODO

  • moar tests :)

  • SERVER_PUSH

  • follow_redirects

  • priority control

Development setup

If you wish to create a development environment to work on th2c, you can use a Vagrant setup or a virtual environment. The Vagrant setup is located under vm, an Ubuntu 16.04 64bit box with Go and Python 2 installed, that maps the project directory under /opt/dev/th2c.

For a minimal set of “integration tests”, a Go web server is included in test_server that simply echoes back what it receives.

You can run it in debug mode, from the project directory, by executing:

GODEBUG=http2debug=1 go run test_server/main.go.

After the server has started, you should run the client by executing:

python -m th2c.

Log files should be produced under /opt/dev/th2c/logs.

You can also run unit tests with: nosetests tests

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

th2c-0.4.1.tar.gz (13.1 kB view details)

Uploaded Source

File details

Details for the file th2c-0.4.1.tar.gz.

File metadata

  • Download URL: th2c-0.4.1.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/2.7.15

File hashes

Hashes for th2c-0.4.1.tar.gz
Algorithm Hash digest
SHA256 80929616c099b2d8120c660a7c446363efd412efc7fc7a328ddc476fabffaa6c
MD5 b4b4ec3e7cf2ce9c2952fe29e0ccf130
BLAKE2b-256 7cae4301d060e86c6a46af96fedc959a5239dc1e73660ef6881062842e35387c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page