MODULE REFERENCE

client

anomx.integrations.platform.client

Authenticated JSON transport without dataset, run, or workspace operations.

PlatformClient

PlatformClient(url: str, token: str, timeout: float = 30.0, health_path: str = '/system/health')

An authenticated API connection, independent of any resource class.

A site origin such as https://host becomes https://host/api. Explicit API prefixes (including /api/v1 and reverse-proxy paths) are preserved. Paths passed to HTTP methods are relative to that API prefix, starting with /. Responses are decoded JSON; empty responses are None.

Credentials come only from arguments or from_env(). Requests have a bounded timeout, are never retried, and do not follow redirects.

Signature parameters
ParameterTypeDefault
urlstrrequired
tokenstrrequired
timeoutfloat30.0
health_pathstr'/system/health'

Members

urlattribute
tokenattribute
token: str = field(repr=False)
timeoutattribute
health_pathattribute
health_path: str = '/system/health'
from_envclassmethod
from_env() -> PlatformClient

Read ANOMX_URL and ANOMX_TOKEN for a standalone connection.

Returns PlatformClient

requestmethod
request(path: str, payload: JSONValue = None, *, method: str = 'POST', params: QueryParams | None = None) -> JSONValue

Send a JSON request and decode JSON of any shape, or an empty response.

params URL-encodes query values and repeats keys for list values. HTTP errors expose status_code, method, and url. Error messages omit query values, credentials, and response bodies.

Signature parameters
ParameterTypeDefault
pathstrrequired
payloadJSONValueNone
methodkeyword onlystr'POST'
paramskeyword onlyQueryParams | NoneNone

Returns JSONValue

getmethod
get(path: str, *, params: QueryParams | None = None) -> JSONValue

Read a resource, optionally passing query parameters.

Signature parameters
ParameterTypeDefault
pathstrrequired
paramskeyword onlyQueryParams | NoneNone

Returns JSONValue

postmethod
post(path: str, payload: JSONValue = None, *, params: QueryParams | None = None) -> JSONValue

Submit JSON to a resource.

Signature parameters
ParameterTypeDefault
pathstrrequired
payloadJSONValueNone
paramskeyword onlyQueryParams | NoneNone

Returns JSONValue

putmethod
put(path: str, payload: JSONValue = None, *, params: QueryParams | None = None) -> JSONValue

Replace a resource with JSON.

Signature parameters
ParameterTypeDefault
pathstrrequired
payloadJSONValueNone
paramskeyword onlyQueryParams | NoneNone

Returns JSONValue

patchmethod
patch(path: str, payload: JSONValue = None, *, params: QueryParams | None = None) -> JSONValue

Partially update a resource with JSON.

Signature parameters
ParameterTypeDefault
pathstrrequired
payloadJSONValueNone
paramskeyword onlyQueryParams | NoneNone

Returns JSONValue

deletemethod
delete(path: str, *, params: QueryParams | None = None) -> JSONValue

Delete a resource; an empty success response returns None.

Signature parameters
ParameterTypeDefault
pathstrrequired
paramskeyword onlyQueryParams | NoneNone

Returns JSONValue

headmethod
head(path: str, *, params: QueryParams | None = None) -> None

Check a resource's HTTP status without decoding a body.

Signature parameters
ParameterTypeDefault
pathstrrequired
paramskeyword onlyQueryParams | NoneNone

Returns None

is_alivemethod
is_alive() -> bool

Check the configured health resource for status: ok.

Return False for HTTP, connection, timeout, or invalid-response errors. This checks API liveness, not access to a particular dataset or resource.

Returns bool

PlatformError

PlatformError(message: str, *, status_code: int | None = None, method: str | None = None, url: str | None = None)

Bases: RuntimeError

A failed API request, with HTTP status and request location when available.

Signature parameters
ParameterTypeDefault
messagestrrequired
status_codekeyword onlyint | NoneNone
methodkeyword onlystr | NoneNone
urlkeyword onlystr | NoneNone

PlatformTimeoutError

PlatformTimeoutError(message: str, *, status_code: int | None = None, method: str | None = None, url: str | None = None)

Bases: PlatformError

The request exceeded the configured socket timeout.

Signature parameters
ParameterTypeDefault
messagestrrequired
status_codekeyword onlyint | NoneNone
methodkeyword onlystr | NoneNone
urlkeyword onlystr | NoneNone