capo-cloudhsm: typed, async Python SDK for AWS Cloudhsm
capo-cloudhsm is a typed Python SDK for AWS Cloudhsm. It has an async client, AsyncCloudHSMClient, for asyncio and trio, and a sync client, CloudHSMClient, with the same methods. Requests and responses are typed with TypedDicts, so your editor and type checker know every field.
It is part of capo, a community-driven alternative to boto3 and aioboto3, built on its own HTTP stack instead of botocore and generated from the official AWS Smithy models. Documentation: https://capo-sdk.dev/services/cloudhsm/
Installation
pip install capo-cloudhsm
Usage
from capo_cloudhsm import AsyncCloudHSMClient
async def main():
async with AsyncCloudHSMClient() as cloud_hsm:
# Example: call the add_tags_to_resource operation
response = await cloud_hsm.add_tags_to_resource()
print(response["status"])
Error Handling
The SDK raises exceptions for errors returned by the API. Catch them to handle failures gracefully.
from capo_cloudhsm import AsyncCloudHSMClient
from capo_cloudhsm.error import CloudHsmInternalException
async def main():
async with AsyncCloudHSMClient() as cloud_hsm:
try:
await cloud_hsm.add_tags_to_resource()
except CloudHsmInternalException as e:
print(f"Error: {e}")
print(e.data) # additional error data
Retrying
The SDK retries failed operations automatically. Retry behaviour follows the Smithy specification: errors are retried based on their is_retryable and is_throttling_error attributes. Throttling errors use a longer base delay. Network-level failures (connection errors and timeouts) are also retried. Non-retryable errors, such as client errors without the @retryable trait, are raised immediately without further attempts.
The number of attempts defaults to 3 and can be changed at the client level via retry_max_attempts, or per call via config_overrides.
from capo_cloudhsm import AsyncCloudHSMClient
async def main():
async with AsyncCloudHSMClient() as cloud_hsm:
# Default: 3 attempts for every operation
response = await cloud_hsm.add_tags_to_resource()
# Override per operation
response = await cloud_hsm.add_tags_to_resource(config_overrides={"retry_max_attempts": 5})
# Disable retries for this call
response = await cloud_hsm.add_tags_to_resource(config_overrides={"retry_max_attempts": 1})
Metadata
Release files for capo-cloudhsm 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| capo_cloudhsm-0.8.0.tar.gz | 81.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| capo_cloudhsm-0.8.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 229.1 kB
Release files / capo_cloudhsm-0.8.0.tar.gz
| Download URL | capo_cloudhsm-0.8.0.tar.gz |
|---|---|
| Size | 81.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7cf3f6275f627cdc287a7d432e48581549300c8b33e87483e0a94416ce18c41
|
|
BLAKE2b-256 checksum How to use checksums |
ecdaf644336cf309f7df5a590b7443c1595e81460cbfbfabfc8791d2dc98a5f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / capo_cloudhsm-0.8.0-py3-none-any.whl
| Download URL | capo_cloudhsm-0.8.0-py3-none-any.whl |
|---|---|
| Size | 147.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
06dcdb7fe7c82562e69e062b87fde8c24fcb817ae5dcefd27e1b3c1d09d29d16
|
|
BLAKE2b-256 checksum How to use checksums |
4774c3f262d5afc782fb4bd7a9e97d5ac4711e0c9b8f621005ca3cfb66b0ace5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|