Client utilities for interacting with Wasabi Account Control Manager APIs.
Project description
wasabi-wacm
Python client utilities for the Wasabi Account Control Manager API.
This project provides a small, synchronous Python wrapper around the Wasabi Account Control Manager (WACM) REST API. It uses requests, exposes one WACMClient, and keeps responses as raw requests.Response objects so callers can decide how to parse and handle API payloads.
This is an independent open source project. It is not affiliated with, endorsed by, or sponsored by Wasabi Technologies.
Features
- Basic-auth configuration from
usernameandpassword - Reusable
requests.Sessionwith context-manager support - Endpoint helpers for control accounts, channel accounts, sub-accounts, standalone accounts, members, invoices, and usage
- Automatic omission of
Nonequery parameters - Lowercase boolean query parameter serialisation for WACM-compatible URLs
WACMRequestErrorwrapper that preserves the originalrequests.Response
Requirements
- Python 3.9 or later
requests- Access to a Wasabi Account Control Manager account and API credentials
Installation
Install from source:
git clone https://github.com/Cenvora/wasabi-wacm.git
cd wasabi-wacm
pip install -e .
When a release is available from PyPI or your internal package index, install the configured package name with:
pip install wasabi-wacm
For development dependencies:
pip install -e ".[dev]"
Quick Start
from wasabi_wacm import WACMClient
with WACMClient(
username="your-basic-auth-username",
password="your-basic-auth-password",
) as client:
response = client.get_sub_accounts(page=1, size=20)
print(response.json())
By default, the client uses:
https://api.wacm.wasabisys.com/api
Override it when you need to target another WACM API root:
from wasabi_wacm import WACMClient
client = WACMClient(
base_url="https://api.wacm.wasabisys.com/api",
username="your-basic-auth-username",
password="your-basic-auth-password",
timeout=30,
)
Authentication
WACM API access commonly uses HTTP Basic Auth. Passing username and password configures requests.auth.HTTPBasicAuth automatically:
from wasabi_wacm import WACMClient
client = WACMClient(username="user", password="secret")
If you need custom authentication, pass any requests.auth.AuthBase instance:
import requests
from wasabi_wacm import WACMClient
class BearerAuth(requests.auth.AuthBase):
def __init__(self, token: str) -> None:
self.token = token
def __call__(self, request: requests.PreparedRequest) -> requests.PreparedRequest:
request.headers["Authorization"] = f"Bearer {self.token}"
return request
client = WACMClient(auth=BearerAuth("token"))
Usage Examples
List sub-accounts:
from wasabi_wacm import WACMClient
with WACMClient(username="user", password="secret") as client:
sub_accounts = client.get_sub_accounts(
page=1,
size=50,
include_deleted=False,
include_keys=False,
).json()
Fetch latest usage for a sub-account:
from wasabi_wacm import WACMClient
with WACMClient(username="user", password="secret") as client:
usage = client.get_usages(
sub_account_id=12345,
latest=True,
).json()
Create a sub-account:
from wasabi_wacm import WACMClient
payload = {
"controlAccountId": 3732,
"name": "example-sub-account",
"wasabiAccountEmail": "storage-admin@example.com",
"password": "change-me",
}
with WACMClient(username="user", password="secret") as client:
created = client.create_sub_account(payload).json()
print(created)
Configure a shared session:
import requests
from wasabi_wacm import WACMClient
session = requests.Session()
session.proxies = {"https": "http://proxy.example.com:3128"}
with WACMClient(username="user", password="secret", session=session) as client:
countries = client.get_countries().json()
Supported Endpoint Groups
| Area | Methods |
|---|---|
| Channel accounts | create_channel_account, create_channel_account_user, get_channel_accounts, get_channel_account, update_channel_account, delete_channel_account_user, delete_channel_account |
| Control accounts | get_control_accounts, get_control_account, get_control_account_usage, get_control_account_bucket_utilization |
| Invoices | get_invoices, get_invoice |
| Members | create_member, get_members, get_member, update_member, delete_member |
| Standalone accounts | create_standalone_account, get_standalone_accounts, get_storage_amounts, get_countries |
| Sub-accounts | create_sub_account, get_sub_accounts, get_sub_account, update_sub_account, patch_sub_account, delete_sub_account, get_sub_account_bucket_utilization |
| Usage | get_usages, get_usage |
All endpoint methods return a requests.Response. Use .json(), .text, .content, or other requests response APIs depending on the endpoint.
Error Handling
response.raise_for_status() is called internally. Non-successful HTTP responses are wrapped in WACMRequestError, and the original response remains available on the exception:
from wasabi_wacm import WACMClient, WACMRequestError
try:
with WACMClient(username="user", password="bad-password") as client:
client.get_sub_accounts()
except WACMRequestError as exc:
print(exc)
print(exc.response.status_code)
print(exc.response.text)
Development
Run the test suite:
pytest
Run type checking:
mypy wasabi_wacm
The public client is composed from focused endpoint mixins under wasabi_wacm/endpoints. When adding WACM operations, prefer adding the method to the resource-specific mixin and exposing it through WACMClient via wasabi_wacm/endpoints/__init__.py.
Documentation
- Wasabi Account Control Manager documentation
- Wasabi Account Control API reference
- Requests documentation
License
This project is licensed under the Apache License 2.0. See LICENSE for details.
Wasabi, Wasabi Account Control Manager, and the Wasabi logo are trademarks of Wasabi Technologies. The logo asset in this repository was downloaded from wasabi.com and is used only to identify the third-party service targeted by this client.
Contributors
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wasabi_wacm-0.1.0.tar.gz.
File metadata
- Download URL: wasabi_wacm-0.1.0.tar.gz
- Upload date:
- Size: 27.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bed54e8645b8efc0c4807631ad9287091330939d58e539bfcc5586a8c7bd7125
|
|
| MD5 |
3d64c26651e3c8593484badf24ccf09c
|
|
| BLAKE2b-256 |
652891cc65cd72a6cc1f7f05ddcf7e466f2a541636ffb04ec7a638e3c112924e
|
Provenance
The following attestation bundles were made for wasabi_wacm-0.1.0.tar.gz:
Publisher:
publish-on-release.yml on Cenvora/wasabi-wacm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wasabi_wacm-0.1.0.tar.gz -
Subject digest:
bed54e8645b8efc0c4807631ad9287091330939d58e539bfcc5586a8c7bd7125 - Sigstore transparency entry: 1402357763
- Sigstore integration time:
-
Permalink:
Cenvora/wasabi-wacm@b2edbc4fd6dfcc903d630047f55daa6daa700d1f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Cenvora
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-on-release.yml@b2edbc4fd6dfcc903d630047f55daa6daa700d1f -
Trigger Event:
push
-
Statement type:
File details
Details for the file wasabi_wacm-0.1.0-py3-none-any.whl.
File metadata
- Download URL: wasabi_wacm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e21e6595955f0958410cd676bb288e23c671478e3b2aa9da4654f8467dc25b45
|
|
| MD5 |
15fd4b40fc6b765902c13f2f1c6fd202
|
|
| BLAKE2b-256 |
5742514d41a90f980acdbc632f3f765352927b7220d0345d12848f73a34c4355
|
Provenance
The following attestation bundles were made for wasabi_wacm-0.1.0-py3-none-any.whl:
Publisher:
publish-on-release.yml on Cenvora/wasabi-wacm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wasabi_wacm-0.1.0-py3-none-any.whl -
Subject digest:
e21e6595955f0958410cd676bb288e23c671478e3b2aa9da4654f8467dc25b45 - Sigstore transparency entry: 1402357839
- Sigstore integration time:
-
Permalink:
Cenvora/wasabi-wacm@b2edbc4fd6dfcc903d630047f55daa6daa700d1f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Cenvora
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-on-release.yml@b2edbc4fd6dfcc903d630047f55daa6daa700d1f -
Trigger Event:
push
-
Statement type: