- integrations
- Python
- ocx_sdk
Ocx (2 of 4)
Ocxclass#
ocx_sdk._clientView sourcepatchproperty#
patch: PatchCommandsThe ocx patch command group.
session_configproperty#
session_config: OcxConfigThe OcxConfig this handle spawns under.
Read-only, and the config itself is frozen: derive a variant with
with_config(...) rather than trying to write through this. Not
spelled config because ocx.config is the ocx config command
group, and command alignment wins over the shorter name.
aboutmethod#
def about(timeout: MaybeTimeout = UNSET, retry: MaybeRetry = UNSET) -> AboutInfoReport what this ocx build is and where it keeps its state.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
timeout | MaybeTimeout | UNSET | Seconds per attempt. Omitted takes the config’s. |
retry | MaybeRetry | UNSET | Retry policy. None opts out; omitted takes the config’s. |
Returns
AboutInfo- The parsed
ocx aboutpayload.
loginmethod#
def login(registry: str | None = None, *, username: str, token: str, allow_insecure_store: bool = False, verify: bool = True, timeout: MaybeTimeout = UNSET, retry: MaybeRetry = UNSET) -> LoginResultAuthenticate to a registry and let ocx persist the credentials.
The token travels on stdin through --password-stdin, never in argv,
and is redacted from logs and errors for the duration of the call.
Retries are off by default: a timed-out login exits 75, and
re-sending credentials on a timeout is the auth-retry mistake the
policy exists to prevent. Pass retry= explicitly to override.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
registry | str | None | None | The registry hostname. None falls back to ocx’s
OCX_DEFAULT_REGISTRY. |
username | str | required | The account name. Required — the SDK never prompts. |
token | str | required | The password or token, written to ocx’s stdin. |
allow_insecure_store | bool | False | Permit the plaintext auths fallback when
no credential helper is configured. |
verify | bool | True | Check the credentials against the registry before storing them. |
timeout | MaybeTimeout | UNSET | Seconds per attempt. Omitted takes the config’s. |
retry | MaybeRetry | UNSET | Retry policy. Defaults to no retries. |
Returns
LoginResult- The registry and username ocx recorded.
spawn_asyncmethodasync#
async def spawn_async(argv: Sequence[str], **popen_kw: Any) -> asyncio.subprocess.ProcessStart an arbitrary ocx command line on the event loop.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
argv | Sequence[str] | required | The command and its arguments, without the binary. |
**popen_kw | Any | {} | Forwarded to the subprocess factory. args, shell,
and executable are rejected. |
Returns
asyncio.subprocess.Process- The running child.
Raises
ValueErrorargs,shell, orexecutablewas passed.TypeErrorenvwas passed — seespawn.
with_configmethod#
def with_config(**overrides: Unpack[ConfigOverrides]) -> OcxDerive a handle with some configuration fields replaced.
The derived handle shares this one’s binary, host environment,
on_log, and compatibility memo — only the configuration differs.
Changing any of the others means constructing a fresh Ocx.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
**overrides | Unpack[ConfigOverrides] | {} | OcxConfig field names and their new values, as
ConfigOverrides spells them. |
Returns
Ocx- The derived handle.
Raises
TypeError- An override names no
OcxConfigfield. A type checker catches that first; the runtime guard is for callers who build the keywords dynamically.