This release is a pre-release and may not be stable for production use.
ohttpy Package
Introduction
This package allows for client-side OHTTP-wrapping over HTTP communication. It acheives this by providing drop-in replacement classes for requests.Session and httpx.BaseTransport classes that abstract the OHTTP layer.
NOTE: This package utilizes a modified Rust library that implements OHTTP and relies on the chunked OHTTP protocol which has not been ratified into a standard at the time of writing.
Optional Parameter Configurability
The ohttpy.Transport and ohttpy.Session class constructors take in the following optional parameters:
- key_config: The OHTTP Key Configuration and its encoding format are defined by OHTTP RFC9458. This configuration contains the OHTTP public key and the set of algorithms for the HPKE context. By default, the classes will fetch the OHTTP Key Configuration dynamically from
{url.scheme}://{url.authority}/discoverwhereurlis the OHTTP Gateway address. This is not the usual flow for OHTTP clients so this parameter allows the user to provide the key configuration.
Requests Session Example
To use OHTTP in a requests.Session setting, simply replace the object construction with ohttpy.Session:
import ohttpy
# Create ohttpy session that inherits from requests.Session.
session = ohttpy.Session()
# Use session like a request.Session including streaming response support.
resp = session.post("http://ohttp-server/path/to/post", data="test data", stream=True)
resp.raise_for_error()
for chunk in resp.iter_content():
if chunk:
print(chunk.decode(), end="", flush=True)
HTTPX Transport Example
To use OHTTP in a httpx.Transport setting, simply replace the object construction with ohttpy.Transport:
import httpx
import ohttpy
# Initialize httpx client with the ohttpy Transport that inherits from httpx.Transport
httpx_client = httpx.Client(transport=ohttpy.Transport())
# Use client as normal including streaming response support.
method = "GET"
url = "http://ohttp-server/path/to/get/"
with httpx_client.stream(method, url) as resp:
resp.raise_for_error()
for chunk in resp.stream:
print(chunk.decode(), end="", flush=True)
This is also applicable to clients that utilize httpx for their HTTP communication, for example openai client:
import httpx
import openai
import ohttpy
# Initialize httpx client with the ohttpy Transport that inherits from httpx.Transport
httpx_client = httpx.Client(transport=ohttpy.Transport())
url = "http://ohttp-server"
api_key = "API_KEY"
# Configure OpenAI client with httpx client
client = openai.OpenAI(
api_key=api_key,
http_client=httpx_client,
base_url=url + "/v1")
# Use OpenAI SDK as normal for example llama chat (including stream capability)
completion = client.chat.completions.create(
model="meta-llama/Llama-3.2-3B-Instruct",
messages=[
{"role": "system", "content": "You are a helpful AI assistant."},
{"role": "user", "content": "where does the sun rise from?"},
],
temperature=0.2,
top_p=0.7,
max_tokens=1024,
stream=True,
)
for chunk in completion:
print(chunk.choices[0].delta.content or "", end="", flush=True)
Metadata
Release files for ohttpy 0.1a13
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| ohttpy-0.1a13-cp37-abi3-win_amd64.whl | CPython 3.7 | abi3 | Windows x86-64 | Details for ohttpy-0.1a13-cp37-abi3-win_amd64.whl |
| ohttpy-0.1a13-cp37-abi3-manylinux_2_28_aarch64.whl | CPython 3.7 | abi3 | Linux glibc 2.28+ ARM64 | Details for ohttpy-0.1a13-cp37-abi3-manylinux_2_28_aarch64.whl |
| ohttpy-0.1a13-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.7 | abi3 | Linux glibc 2.17+ x86-64 | Details for ohttpy-0.1a13-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
| ohttpy-0.1a13-cp37-abi3-macosx_11_0_arm64.whl | CPython 3.7 | abi3 | macOS 11.0+ ARM64 | Details for ohttpy-0.1a13-cp37-abi3-macosx_11_0_arm64.whl |
| ohttpy-0.1a13-cp37-abi3-macosx_10_12_x86_64.whl | CPython 3.7 | abi3 | macOS 10.12+ x86-64 | Details for ohttpy-0.1a13-cp37-abi3-macosx_10_12_x86_64.whl |
Total release size: 11.6 MB
Release files / ohttpy-0.1a13-cp37-abi3-win_amd64.whl
| Download URL | ohttpy-0.1a13-cp37-abi3-win_amd64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.7 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
8bdd3ab21050c8baf6cbb8c5398315d732ea282783bd83a99ec7e7f2fd2c5d67
|
|
BLAKE2b-256 checksum How to use checksums |
a535b6c2c83c49cdfd3f4191fb7cb8d0d04602f331aefb679474fef2bdf40bda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 9, 2025.
Transparency logRelease files / ohttpy-0.1a13-cp37-abi3-manylinux_2_28_aarch64.whl
| Download URL | ohttpy-0.1a13-cp37-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 2.5 MB |
| Tags | CPython 3.7 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
d782fc7ac47f789aa545aa2389145b679b4c89b20f2fbe70cc55fb03f862b69d
|
|
BLAKE2b-256 checksum How to use checksums |
89c512ac16639bb4c8b746bbfd30347122fd2ed96dcbf2f1aa6e610650b33595
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 9, 2025.
Transparency logRelease files / ohttpy-0.1a13-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | ohttpy-0.1a13-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.6 MB |
| Tags | CPython 3.7 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
cde017aebea93f6973e4e5a33b7b634c7ec72eb3e0b8ce8991b76ce684a03a73
|
|
BLAKE2b-256 checksum How to use checksums |
823a7bcd32b25ef44cfcc6b54a213b2557212175f1a21dcdbd0639c110f0d3f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 9, 2025.
Transparency logRelease files / ohttpy-0.1a13-cp37-abi3-macosx_11_0_arm64.whl
| Download URL | ohttpy-0.1a13-cp37-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.7 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
f2babdb8162a94a8cf49ed0bb2d37a3f350fd1c845c8332eb7e540d68ddf7770
|
|
BLAKE2b-256 checksum How to use checksums |
0afaa4b3df41ae71014c4012b219b69ddd6e9e6326f07c6bac9fab1a630e37ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 9, 2025.
Transparency logRelease files / ohttpy-0.1a13-cp37-abi3-macosx_10_12_x86_64.whl
| Download URL | ohttpy-0.1a13-cp37-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.7 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
873af8e61e24bda29d59a29e50a4b33d2f5babb6a16459f7048412992814964c
|
|
BLAKE2b-256 checksum How to use checksums |
108edf517acf8048446330feec8c0643f98368814ac8545cd342029840418027
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 9, 2025.
Transparency logSecurity for ohttpy 0.1a13
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 5 files in this release have been uploaded with provenance metadata.
Attestation for ohttpy-0.1a13-cp37-abi3-win_amd64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 9, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.