Sample
httpcore 1.0.9: httpcore
Verified sample for pypi httpcore 1.0.9: httpcore. The contract ran on python 3.12 · linux debian/x64 · docker and passed: assert httpcore.Origin parses and…
sha256:f16a87e20d7ebe333ee8e0286377d0e1a7c67c425a8888379e1a1130b187bbf7
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux 24 · ubuntu · glibc 2.39 x64 pip
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| python 3.12 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · python@1python:3.12-slim@sha256:09f7da3bc104… |
2026-09-06 |
Case
HOW- Goal
- verify httpcore in pkg:pypi/httpcore@1.0.9
- Packages
- Symbols
-
- httpcore
- Created
- 2026-09-06T05:06:44Z
Contract
- assert httpcore.Origin parses and exposes scheme, host, and port components
- assert httpcore.HTTPProxy executes HTTP requests through a proxy using httpcore.MockBackend offline
- assert httpcore.HTTPProxy supports proxy authentication credentials
- assert httpcore.default_ssl_context returns an SSLContext instance
- assert httpcore.ProxyError and httpcore.ConnectionNotAvailable inherit from Exception
- assert httpcore.PoolTimeout and httpcore.ConnectTimeout inherit from httpcore.TimeoutException
Files
- PROMPT.md
- csx.json
- pyproject.toml
- requirements.txt
- sample.py
- spec.json
- test/contract.py
Source
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify httpcore in pkg:pypi/httpcore@1.0.9
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:pypi/httpcore@1.0.9
Demonstrate these symbols/APIs:
- httpcore
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:587ca446dce1e3230e888a4af0e54bf14af1590e3f1a395943b7b5eb50fea192","contract":["assert httpcore.Origin parses and exposes scheme, host, and port components","assert httpcore.HTTPProxy executes HTTP requests through a proxy using httpcore.MockBackend offline","assert httpcore.HTTPProxy supports proxy authentication credentials","assert httpcore.default_ssl_context returns an SSLContext instance","assert httpcore.ProxyError and httpcore.ConnectionNotAvailable inherit from Exception","assert httpcore.PoolTimeout and httpcore.ConnectTimeout inherit from httpcore.TimeoutException"],"goal":"verify httpcore in pkg:pypi/httpcore@1.0.9","kind":"HOW","packages":["pkg:pypi/httpcore@1.0.9"],"schemaVersion":1,"symbols":["httpcore"]},"contractCommand":["python","test/contract.py"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"pypi","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"pip","schemaVersion":1},"license":"MIT-0","packages":["pkg:pypi/httpcore@1.0.9"],"schemaVersion":1,"subject":"pkg:pypi/httpcore@1.0.9","symbols":["httpcore"],"verifierAdapter":"python@1"}
[project]
name = "verify-httpcore"
version = "0.1.0"
dependencies = [
"httpcore==1.0.9",
"certifi",
"h11",
]
httpcore==1.0.9
certifi
h11
"""Sample demonstrating httpcore proxy, origin, ssl context, and exception handling."""
import ssl
import httpcore
def create_origin(scheme: bytes, host: bytes, port: int) -> httpcore.Origin:
"""Construct a network origin."""
return httpcore.Origin(scheme, host, port)
def make_proxy_request(
proxy_url: str,
target_url: str,
response_data: bytes,
proxy_auth: tuple[str, str] | None = None,
) -> tuple[int, bytes]:
"""Send a request through HTTPProxy using a mock backend offline."""
mock_backend = httpcore.MockBackend(
buffer=[
b"HTTP/1.1 200 OK\r\n",
b"Content-Type: text/plain\r\n",
f"Content-Length: {len(response_data)}\r\n".encode("ascii"),
b"\r\n",
response_data,
]
)
with httpcore.HTTPProxy(
proxy_url=proxy_url,
proxy_auth=proxy_auth,
network_backend=mock_backend,
) as proxy:
resp = proxy.request("GET", target_url)
return resp.status, resp.read()
def get_default_ssl_context() -> ssl.SSLContext:
"""Obtain default SSL context from httpcore."""
return httpcore.default_ssl_context()
{
"schemaVersion": 1,
"goal": "verify httpcore in pkg:pypi/httpcore@1.0.9",
"kind": "HOW",
"packages": [
"pkg:pypi/httpcore@1.0.9"
],
"symbols": [
"httpcore"
]
}
"""Contract verification test for httpcore in pkg:pypi/httpcore@1.0.9."""
import os
import ssl
import sys
# Ensure sample root directory is in sys.path
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import httpcore
import sample
def test_origin_components() -> None:
"""Assertion: assert httpcore.Origin parses and exposes scheme, host, and port components."""
origin = sample.create_origin(b"https", b"example.com", 443)
assert origin.scheme == b"https"
assert origin.host == b"example.com"
assert origin.port == 443
def test_http_proxy_mock_backend() -> None:
"""Assertion: assert httpcore.HTTPProxy executes HTTP requests through a proxy using httpcore.MockBackend offline."""
status, body = sample.make_proxy_request(
proxy_url="http://proxy.example.com:8080",
target_url="http://target.example.com/data",
response_data=b"proxy-ok",
)
assert status == 200
assert body == b"proxy-ok"
def test_http_proxy_authentication() -> None:
"""Assertion: assert httpcore.HTTPProxy supports proxy authentication credentials."""
status, body = sample.make_proxy_request(
proxy_url="http://proxy.example.com:8080",
target_url="http://target.example.com/secure",
response_data=b"authenticated",
proxy_auth=("proxyuser", "secretpass"),
)
assert status == 200
assert body == b"authenticated"
def test_default_ssl_context() -> None:
"""Assertion: assert httpcore.default_ssl_context returns an SSLContext instance."""
ctx = sample.get_default_ssl_context()
assert isinstance(ctx, ssl.SSLContext)
def test_exception_hierarchy() -> None:
"""Assertion: assert httpcore.ProxyError and httpcore.ConnectionNotAvailable inherit from Exception."""
assert issubclass(httpcore.ProxyError, Exception)
assert issubclass(httpcore.ConnectionNotAvailable, Exception)
assert issubclass(httpcore.PoolTimeout, httpcore.TimeoutException)
assert issubclass(httpcore.ConnectTimeout, httpcore.TimeoutException)
assert issubclass(httpcore.RemoteProtocolError, httpcore.ProtocolError)
assert issubclass(httpcore.LocalProtocolError, httpcore.ProtocolError)
def main() -> None:
test_origin_components()
test_http_proxy_mock_backend()
test_http_proxy_authentication()
test_default_ssl_context()
test_exception_hierarchy()
print("All httpcore contract assertions passed.")
if __name__ == "__main__":
main()
Origin Seeder
anonymous