Registry / http-networking / smithy-http

smithy-http

JSON →
library0.4.1pypypi✓ verified 88d ago

Smithy-http provides foundational HTTP components and primitives for Smithy tooling in Python. It defines standard interfaces for HTTP requests, responses, headers, and middleware, ensuring compliance with Smithy's protocol specifications. This library is primarily a building block for Smithy-generated Python clients and other Smithy-compliant services. The current version is 0.4.0, and releases are generally tied to the development cadence of the broader `smithy-python` project.

pip install smithy-http
INSTALL
IMPORT
SIG · SMITHY-HTTP
S
smithy-http
http-networkingpythonv0.4.1
Install
1.6s avg
Import
—
Disk
13MB
Pass rate
4/ 10
Env Coverage4 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.4.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✕ build_error
py 3.11
✕ build_error
✕ build_error
py 3.12
✓ —
✓ 1.55s
py 3.13
✓ —
✓ 1.6s
py 3.9
✕ build_error
✕ build_error
13MB installed
● package 13MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

interfaces
✓ from smithy_http import interfaces
✗ from smithy_http.request import HttpRequest
Field
✓ from smithy_http import Field
Fields
✓ from smithy_http import Fields

This quickstart demonstrates how to construct basic `HttpRequest` and `HttpResponse` objects using `smithy-http`'s core components. It highlights how to set the HTTP method, URL, headers, and body for both request and response entities. Note that `smithy-http` does not perform actual network calls; it provides the data structures for them.

from smithy_http.request import HttpRequest from smithy_http.response import HttpResponse from smithy_http.headers import Headers from io import BytesIO # --- Construct an HttpRequest --- url = "https://example.com/path" method = "POST" headers = Headers({"Content-Type": "application/json", "Accept": "application/json"}) body_content = b'{"key": "value"}' body = BytesIO(body_content) request = HttpRequest( method=method, url=url, headers=headers, body=body ) print(f"Request Method: {request.method}") print(f"Request URL: {request.url}") print(f"Request Headers: {dict(request.headers)}") request.body.seek(0) print(f"Request Body: {request.body.read().decode('utf-8')}") # --- Construct an HttpResponse --- status_code = 200 response_headers = Headers({"Content-Type": "application/json"}) response_body_content = b'{"message": "success"}' response_body = BytesIO(response_body_content) response = HttpResponse( status_code=status_code, headers=response_headers, body=response_body ) print(f"\nResponse Status Code: {response.status_code}") print(f"Response Headers: {dict(response.headers)}") response.body.seek(0) print(f"Response Body: {response.body.read().decode('utf-8')}")
Debug
Known issues
breakingAs a 0.x.x library, `smithy-http`'s API is subject to change without strict backward compatibility guarantees. Expect potential breaking changes between minor versions as the library matures towards a 1.0 release.
fix
Refer to the `smithy-python` project's changelog for specific migration steps when upgrading to newer 0.x.x versions.
affects: <1.0.0
gotcha`smithy-http` is a low-level library providing HTTP primitives (request/response objects, headers). It is NOT an HTTP client (like `requests` or `httpx`) and does not perform actual network requests. It's designed to be integrated into other frameworks or clients.
fix
Do not expect `smithy-http` to send or receive data over the network. It merely defines the structure for HTTP messages. You'll need to use a separate HTTP client library (e.g., `aiohttp`, `urllib3`) to handle the network I/O with `smithy-http` objects.
affects: All
gotcha`smithy-http` is heavily typed. Constructors and methods often require specific Python types (e.g., `str` for URLs, `BytesIO` for bodies). Providing incorrect types will lead to `TypeError` exceptions.
fix
Always refer to the type hints in the library's source code or documentation. For request/response bodies, use `io.BytesIO` containing bytes, not strings directly.
affects: All
Upgrade
Version history
0.4.1latest on PyPI · released May 21, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
smithy-http — pip install smithy-http · libregistry