Runtime library for ReflectAPI Python clients
Project description
reflectapi-runtime
Runtime support library for Python clients generated by
reflectapi. Generated code
imports from reflectapi_runtime; you don't normally call this library
directly.
What it provides
ClientBase/AsyncClientBase— base classes used by the generatedClient/AsyncClient. They wraphttpxand handle request build-up, Pydantic-based response validation, and middleware.ApiResponse[T, E]— typed wrapper around the response value, transport metadata, and the optional typed error.ApplicationError,NetworkError,TimeoutError,ValidationError— exceptions raised by the generated methods on non-2xx, transport, and validation failures respectively.ReflectapiOption— three-state Option used by the generated models (some/none/undefined) so absent and explicit-null can round-trip.- Authentication helpers (
BearerTokenAuth,APIKeyAuth,BasicAuth,OAuth2ClientCredentialsAuth,OAuth2AuthorizationCodeAuth). - Middleware, batching, and testing utilities (
MockClient,CassetteMiddleware).
Streaming endpoints
Endpoints declared with Builder::stream_route on the server are exposed on
the generated client as ordinary methods that return an iterator:
async with AsyncClient("http://localhost:3000") as client:
async for event in client.pets.cdc_events(headers=headers):
... # process each event
The sync client returns a regular Iterator; both validate each event
against the declared item model. The wire format is Server-Sent Events
(data: <json>\n\n); init failures (4xx/5xx) raise ApplicationError and
do not enter the iterator. Breaking out of the loop or calling
stream.aclose() releases the underlying HTTP connection.
Validation is strict: an event whose payload doesn't match the item model
(for example, an unknown discriminated-union variant added by a newer
server) raises ValidationError mid-stream and the iterator terminates.
Items received before the bad event are still delivered.
Compatibility
Python 3.12+. The package targets the same reflectapi minor version as
the schema you generate from; mismatches will surface at import time.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file reflectapi_runtime-0.17.2a1.tar.gz.
File metadata
- Download URL: reflectapi_runtime-0.17.2a1.tar.gz
- Upload date:
- Size: 60.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab7d7be334d5d5adc773884e86baba7e58a74030f2c3c08aa9078e463e7197b7
|
|
| MD5 |
ed0d10c20f34d8800e56be1116410403
|
|
| BLAKE2b-256 |
9ea8957439cb01a18f05c6368ae9baca6fa2716ba058823bdf7cf3fa5a3dae77
|
Provenance
The following attestation bundles were made for reflectapi_runtime-0.17.2a1.tar.gz:
Publisher:
release.yml on thepartly/reflectapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
reflectapi_runtime-0.17.2a1.tar.gz -
Subject digest:
ab7d7be334d5d5adc773884e86baba7e58a74030f2c3c08aa9078e463e7197b7 - Sigstore transparency entry: 1448677362
- Sigstore integration time:
-
Permalink:
thepartly/reflectapi@75bc5b2e2053b0fc833f6d421e30b3ecd73b88d4 -
Branch / Tag:
refs/tags/v0.17.2-alpha.1 - Owner: https://github.com/thepartly
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@75bc5b2e2053b0fc833f6d421e30b3ecd73b88d4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file reflectapi_runtime-0.17.2a1-py3-none-any.whl.
File metadata
- Download URL: reflectapi_runtime-0.17.2a1-py3-none-any.whl
- Upload date:
- Size: 34.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d6a8e84e17b1c8c6283892fb5f1a4baf7587df3f3d9f8ab02d37232617004e5
|
|
| MD5 |
488bfa44a68009b16f07f9ae7980c70c
|
|
| BLAKE2b-256 |
3937f15e2f630d8bdd6c943c6e07885d4e21f855526da7c2b8d6a2553a179816
|
Provenance
The following attestation bundles were made for reflectapi_runtime-0.17.2a1-py3-none-any.whl:
Publisher:
release.yml on thepartly/reflectapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
reflectapi_runtime-0.17.2a1-py3-none-any.whl -
Subject digest:
8d6a8e84e17b1c8c6283892fb5f1a4baf7587df3f3d9f8ab02d37232617004e5 - Sigstore transparency entry: 1448677471
- Sigstore integration time:
-
Permalink:
thepartly/reflectapi@75bc5b2e2053b0fc833f6d421e30b3ecd73b88d4 -
Branch / Tag:
refs/tags/v0.17.2-alpha.1 - Owner: https://github.com/thepartly
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@75bc5b2e2053b0fc833f6d421e30b3ecd73b88d4 -
Trigger Event:
push
-
Statement type: