Skip to main content

H2O HTTP server library

Project description

https://travis-ci.org/iceb0y/pyh2o.svg?branch=master

The pyh2o module provides Python binding for the H2O HTTP server. Specifically, it provides high performance HTTP 1/2 and websocket server for Python.

Installation

pip install pyh2o

Development

Clone the repository, initialize submodules by git submodule update --init --recursive.

  • Build: python setup.py build

  • Test: python setup.py test

  • Clean: python setup.py clean

End to end test brings up a real server and make requests to it.

Example

Below is an example of serving static content.

import h2o
import socket

class Handler(h2o.Handler):
    def on_req(self):
        self.res_status = 200
        self.send_inline(b'Hello, world!')
        return 0

config = h2o.Config()
host = config.add_host(b'default', 65535)
host.add_path(b'/plaintext').add_handler(Handler)

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, True)
sock.bind(('127.0.0.1', 8888))
sock.listen(0)

loop = h2o.Loop()
loop.start_accept(sock.fileno(), config)
while loop.run() == 0:
    pass

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

pyh2o-0.0.5.tar.gz (16.7 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyh2o-0.0.5-cp35-cp35m-manylinux1_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.5m

pyh2o-0.0.5-cp27-cp27mu-manylinux1_x86_64.whl (1.7 MB view details)

Uploaded CPython 2.7mu

File details

Details for the file pyh2o-0.0.5.tar.gz.

File metadata

  • Download URL: pyh2o-0.0.5.tar.gz
  • Upload date:
  • Size: 16.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyh2o-0.0.5.tar.gz
Algorithm Hash digest
SHA256 1e1cb71cb803d4b30cd668e3787c3295ed6a04f06c9c4616abc6b512554ce039
MD5 371e22488a711108f913d99044b0e90f
BLAKE2b-256 8a78016c9d18bd872ce8d227dab22c27db47ef83b9ad31545f13693652f7f589

See more details on using hashes here.

File details

Details for the file pyh2o-0.0.5-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pyh2o-0.0.5-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 123a353b18a1128a27664fd8849c35ce136de3520a6f854ec59578c3c867f7cd
MD5 174ef37696af54076512dcf130a2fd36
BLAKE2b-256 f5685aa61436dd41314205cc0b3d50e79b43aec2e69622a04d9a4d0961dd8ab5

See more details on using hashes here.

File details

Details for the file pyh2o-0.0.5-cp27-cp27mu-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pyh2o-0.0.5-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0208a1db6c3f1a11c48a7f3dd1d2323d2f4b83f21bf5df45f0be7cb77290f0d2
MD5 fc6ab968ed3c4292eeaebf4ff77c825f
BLAKE2b-256 c4d821cbf5267749f3a6417f5ba8a7ecdcbc5b091fa5826d905d1a9c69aba6b0

See more details on using hashes here.

Supported by

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