Clients¶
AtonixClient
¶
AtonixClient(
api_key: str | None = None,
private_key: RSAPrivateKey | None = None,
private_key_password: str | None = None,
environment: AtonixEnvironment | str = US,
timeout: float = 30.0,
max_retries: int = 3,
)
Bases: _BaseAtonixClient
Synchronous client for interacting with the Atonix OI API.
Note
Authenticated requests are signed with a millisecond UTC timestamp.
The server rejects requests whose clock is too far from server time,
so the host running this client must keep its system clock
synchronized (e.g. via NTP). Significant clock drift surfaces as a
401 AuthenticationError — the error message includes a hint when
a clock-skew cause is suspected.
Initialize the Atonix Client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
str | None
|
API Key (defaults to ATONIX_API_KEY env var). |
None
|
private_key
|
RSAPrivateKey | None
|
RSA Private Key (defaults to loading from ATONIX_PRIVATE_KEY_PATH). |
None
|
private_key_password
|
str | None
|
Password for encrypted private key (defaults to ATONIX_PRIVATE_KEY_PASSWORD env var). |
None
|
environment
|
AtonixEnvironment | str
|
API target environment or custom URL. |
US
|
timeout
|
float
|
Request timeout in seconds. |
30.0
|
max_retries
|
int
|
Number of times to retry transient errors (429, 5xx). |
3
|
request
¶
Executes a synchronous HTTP request to the Atonix API with retry logic.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method
|
str
|
HTTP method (GET, POST, etc.) |
required |
endpoint
|
str
|
API endpoint (e.g., "/v1/assets") |
required |
**kwargs
|
Any
|
Additional arguments passed to httpx.Client.request. |
{}
|
Returns:
| Type | Description |
|---|---|
Any
|
The parsed JSON or text response. |
Raises:
| Type | Description |
|---|---|
AtonixError
|
On API or network errors. |
AsyncAtonixClient
¶
AsyncAtonixClient(
api_key: str | None = None,
private_key: RSAPrivateKey | None = None,
private_key_password: str | None = None,
environment: AtonixEnvironment | str = US,
timeout: float = 30.0,
max_retries: int = 3,
)
Bases: _BaseAtonixClient
Asynchronous client for interacting with the Atonix OI API.
Note
Authenticated requests are signed with a millisecond UTC timestamp.
The server rejects requests whose clock is too far from server time,
so the host running this client must keep its system clock
synchronized (e.g. via NTP). Significant clock drift surfaces as a
401 AuthenticationError — the error message includes a hint when
a clock-skew cause is suspected.
Initialize the async Atonix Client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
str | None
|
API Key (defaults to ATONIX_API_KEY env var). |
None
|
private_key
|
RSAPrivateKey | None
|
RSA Private Key (defaults to loading from ATONIX_PRIVATE_KEY_PATH). |
None
|
private_key_password
|
str | None
|
Password for encrypted private key (defaults to ATONIX_PRIVATE_KEY_PASSWORD env var). |
None
|
environment
|
AtonixEnvironment | str
|
API target environment or custom URL. |
US
|
timeout
|
float
|
Request timeout in seconds. |
30.0
|
max_retries
|
int
|
Number of times to retry transient errors (429, 5xx). |
3
|
request
async
¶
Executes an asynchronous HTTP request to the Atonix API with retry logic.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method
|
str
|
HTTP method (GET, POST, etc.) |
required |
endpoint
|
str
|
API endpoint (e.g., "/v1/assets") |
required |
**kwargs
|
Any
|
Additional arguments passed to httpx.AsyncClient.request. |
{}
|
Returns:
| Type | Description |
|---|---|
Any
|
The parsed JSON or text response. |
Raises:
| Type | Description |
|---|---|
AtonixError
|
On API or network errors. |