Python client for the ShamCash API
Project description
shamcash
Python client for the ShamCash HTTP API.
Installation
pip install shamcash
Quick start
from shamcash import ShamCashAPISync
with ShamCashAPISync(api_token="...") as client:
account = client.list_accounts()[0]
balances = client.get_balances(account.id)
Async
import asyncio
from shamcash import ShamCashAPI
async def main() -> None:
async with ShamCashAPI(api_token="...") as client:
account = (await client.list_accounts())[0]
balances = await client.get_balances(account.id)
transactions = await client.list_transactions(account.id, limit=20)
asyncio.run(main())
Sync
from shamcash import ShamCashAPISync
with ShamCashAPISync(api_token="...") as client:
account = client.list_accounts()[0]
balances = client.get_balances(account.id)
transaction = client.get_transaction(account.id, 184627893)
Errors
- API envelope codes map to typed exceptions such as
AuthInvalidError,AccountNotFoundError,SubscriptionUnavailableError, andRateLimitExceededError. - Transport failures raise
NetworkError. - Timeouts raise
RequestTimeoutError. - Invalid JSON or schema mismatches raise
ProtocolError.
Capabilities
list_accounts()get_account(account_id)get_balances(account_id)list_transactions(account_id, *, start_at=None, end_at=None, transaction_ids=None, coin_id=None, limit=None)get_transaction(account_id, transaction_id)fetch_json_envelope(method, path, params=None)
Models and typing
- Account, balance, and transaction payloads are exposed as typed dataclasses.
- Money fields use
Decimal. - Timestamps use timezone-aware
datetime.
Compatibility
- Python 3.8+
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
shamcash-1.1.4.tar.gz
(10.8 kB
view details)
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 shamcash-1.1.4.tar.gz.
File metadata
- Download URL: shamcash-1.1.4.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9db51b94a4035974bd2f9b233635e1aa5f71c33e19a71c0f2d5d0908ee82890
|
|
| MD5 |
acbd63fa387f5eadaf1a2c49b876d9d6
|
|
| BLAKE2b-256 |
c35e89bb7adb86bdbdb5abc013701c4b7761fb4e9add65a86caf7b6a5e8f58b3
|
File details
Details for the file shamcash-1.1.4-py3-none-any.whl.
File metadata
- Download URL: shamcash-1.1.4-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7518ed5c723156447f238af94b672376e8d6d95f97f3ad99490dfce976312389
|
|
| MD5 |
c6ebb847f6cb857a02cbdf4932c891e0
|
|
| BLAKE2b-256 |
038217532b17e6d50e382b1bf2b25a32552f69cbb0ff8a40968621181f00dcca
|