Skip to main content

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, and RateLimitExceededError.
  • 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/Damascus and 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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shamcash-1.1.5-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

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

Hashes for shamcash-1.1.5.tar.gz
Algorithm Hash digest
SHA256 c7fbdfab6c99564145212c481066f4212195a700f8384e74f6518cf93a2e09db
MD5 ff654b6da68f658f2f6a778f2f34481f
BLAKE2b-256 efc39ef54ea7ed755bc1aa226e8893f75541834bdea1b95d69d67889652f23f2

See more details on using hashes here.

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

Hashes for shamcash-1.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 73ea6c2efbb879531c31cc7322124c805eb2cae883454af5f376828e00437c05
MD5 bbf0f7858a800d464a7e22908665076e
BLAKE2b-256 9402b2cc053998f45f31492e96a0ab002a7a992b857f9b390e3202091e0d9a26

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page