Getting Started
Installation
pip install capo-mpa
Usage
from capo_mpa import AsyncMPAClient
async def main():
async with AsyncMPAClient() as mpa:
# Example: call the get_policy_version operation
response = await mpa.get_policy_version()
print(response["policy_version"])
Pagination
Some operations in this SDK support pagination. If the operation supports pagination it will have an iter_ prefixed method that returns an async iterator.
from capo_mpa import AsyncMPAClient
async def main():
async with AsyncMPAClient() as mpa:
# Example: paginate over list_policies
async for item in mpa.iter_list_policies():
print(item)
Error Handling
The SDK raises exceptions for errors returned by the API. Catch them to handle failures gracefully.
from capo_mpa import AsyncMPAClient
from capo_mpa.error import AccessDeniedException
async def main():
async with AsyncMPAClient() as mpa:
try:
await mpa.get_policy_version()
except AccessDeniedException 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_mpa import AsyncMPAClient
async def main():
async with AsyncMPAClient() as mpa:
# Default: 3 attempts for every operation
response = await mpa.get_policy_version()
# Override per operation
response = await mpa.get_policy_version(config_overrides={"retry_max_attempts": 5})
# Disable retries for this call
response = await mpa.get_policy_version(config_overrides={"retry_max_attempts": 1})
Release files for capo-mpa 0.1.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_mpa-0.1.0.tar.gz | 85.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| capo_mpa-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 275.3 kB
Release files / capo_mpa-0.1.0.tar.gz
| Download URL | capo_mpa-0.1.0.tar.gz |
|---|---|
| Size | 85.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0644cd3679d9ac477027c6bcad0d9aeb1120228a55783f8f1ffd19217822f191
|
|
BLAKE2b-256 checksum How to use checksums |
52beed5d0ea20b6895800b9f9cfe696e9c0ea27c0eebd48a76bf74cc0fc24e7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","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_mpa-0.1.0-py3-none-any.whl
| Download URL | capo_mpa-0.1.0-py3-none-any.whl |
|---|---|
| Size | 189.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
268025ecb2b3abe311f7d1f8a51851b80d38f97716eb76456a2c3aa26764ad92
|
|
BLAKE2b-256 checksum How to use checksums |
54ce472e28b891edfe6ee42165185018b00ffc9f4911cb41e38c7e4c1f4a3b1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","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}
|