- integrations
- Python
- ocx_sdk
DistSource (1 of 2)
DistSourceclassdataclass#
Re-exported from
ocx_sdk._distView sourceauthattributeclass attributeinstance attribute#
auth: Auth | None = field(default=None, repr=False)headersattributeclass attributeinstance attribute#
headers: Mapping[str, str] = field(default=_NO_HEADERS, repr=False)credentialsmethod#
def credentials(env: Mapping[str, str] | None = None) -> CredentialsReturn this source’s credentials, bound to its resolved origin.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
env | Mapping[str, str] | None | None | Environment used to resolve the URL, as in resolve_url. |
Returns
Credentials- Credentials whose origin is the resolved URL’s, or an unbound empty
Credentials- set for a local or in-memory source.
Raises
DistManifestError- The resolved URL is not usable — not https, or carrying userinfo.
datamethodclassmethod#
def data(raw: bytes, sha256: str | None = None) -> DistSourceUse manifest bytes the caller already has.
The vendoring path: ship a dist/<sha256>.json snapshot as package data
and read it back with importlib.resources, which works from a zipped
wheel where a filesystem path does not.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
raw | bytes | required | The manifest body. |
sha256 | str | None | None | Expected digest of raw. |
Returns
DistSource- The source.
Raises
DistManifestErrorsha256is not 64 lowercase hex digits.
pathmethodclassmethod#
def path(path: Path | str, sha256: str | None = None) -> DistSourceRead the manifest from a local file.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
path | Path | str | required | File holding the manifest JSON. |
sha256 | str | None | None | Expected digest of the file contents. |
Returns
DistSource- The source.
Raises
DistManifestErrorsha256is not 64 lowercase hex digits.
resolve_urlmethod#
def resolve_url(env: Mapping[str, str] | None = None) -> str | NoneReturn the URL this source fetches from.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
env | Mapping[str, str] | None | None | Environment consulted for OCX_INSTALL_DIST_URL; only a
source without an explicit location reads it. |
Returns
str | None- The manifest URL, or
Nonefor a local or in-memory source.