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 UTC
datetime. - Naive ShamCash timestamps are interpreted as
Asia/Damascusand normalized to UTC.
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.5.tar.gz
(11.6 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.5.tar.gz.
File metadata
- Download URL: shamcash-1.1.5.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7fbdfab6c99564145212c481066f4212195a700f8384e74f6518cf93a2e09db
|
|
| MD5 |
ff654b6da68f658f2f6a778f2f34481f
|
|
| BLAKE2b-256 |
efc39ef54ea7ed755bc1aa226e8893f75541834bdea1b95d69d67889652f23f2
|
File details
Details for the file shamcash-1.1.5-py3-none-any.whl.
File metadata
- Download URL: shamcash-1.1.5-py3-none-any.whl
- Upload date:
- Size: 9.3 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 |
73ea6c2efbb879531c31cc7322124c805eb2cae883454af5f376828e00437c05
|
|
| MD5 |
bbf0f7858a800d464a7e22908665076e
|
|
| BLAKE2b-256 |
9402b2cc053998f45f31492e96a0ab002a7a992b857f9b390e3202091e0d9a26
|