Skip to main content

Python HPACK library using nahpack

Project description

nahpackpy is an HTTP/2 RFC 7541 HPACK library. It wraps the Rust nahpack library.

Usage

>>> from nahpackpy import Decoder
>>> decoder = Decoder()
>>> headers = decoder.decode_block(
        b'\x82\x86\x84A\x8c\xf1\xe3\xc2\xe5\xf2:k\xa0\xab\x90\xf4\xff'
    )
>>> for header in headers:
        print(header)
Header(name=b':method', value=b'GET')
Header(name=b':scheme', value=b'http')
Header(name=b':path', value=b'/')
Header(name=b':authority', value=b'www.example.com')
>>> from nahpackpy import Encoder
>>> encoder = Encoder()
>>> encoder.encode_block((
        (b':method', b'GET'),
        (b':scheme', b'http'),
        (b':path', b'/'),
        (b':authority', b'www.example.com'),
    ))
b'\x82\x86\x84A\x8c\xf1\xe3\xc2\xe5\xf2:k\xa0\xab\x90\xf4\xff'

Installation

Installation from source requires the use of the Rust language for compilation of extensions. The “Nightly” channel of rust is required. Download a package from rust-lang.org.

You can then create a wheel, which will contain the compiled shared library, by running make. Or, run python setup.py install to install in your current environment.

Misc

nahpackpy is licensed under the Mozilla Public License, Version 2.0.

Project details


Download files

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

Files for nahpackpy, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size nahpackpy-0.1.0.tar.gz (36.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page