Metadata-Version: 2.4
Name: trame-sdk
Version: 0.1.0
Summary: Python SDK for the Trame tenant API
License-Expression: MIT
Project-URL: Homepage, https://github.com/Elvis-92/trame/tree/main/packages/trame-python
Project-URL: Repository, https://github.com/Elvis-92/trame
Project-URL: Issues, https://github.com/Elvis-92/trame/issues
Keywords: trame,api,sdk,payments,finance
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Operating System :: OS Independent
Classifier: Topic :: Office/Business :: Financial
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# Trame Python SDK

Python client for the versioned Trame tenant API. It uses the Python standard
library for HTTPS requests and has no runtime dependencies. The package source
is in this repository.

Install it with:

```sh
python -m pip install trame-sdk
```

```python
from trame_sdk import PaymentDeclaration, TrameClient

trame = TrameClient(api_key="tr_test_...")
declaration: PaymentDeclaration = {
    "amount": 10000,
    "currency": "XOF",
    "country": "BJ",
    "provider": "fedapay",
    "provider_reference": "provider-transaction-id",
    "beneficiary_id": "beneficiary-id",
}
payment = trame.request_operation(
    "declarePayment",
    body=declaration,
    idempotency_key="platform-order-4821",
).json()
```

Every `operationId` in `docs/03-api/openapi.yaml` is accepted by
`request_operation`. Pass `path`, `query`, `body`, and `idempotency_key` as
keyword arguments. `ApiResponse` preserves response headers and raw bytes, so
CSV and PDF results can be read without JSON decoding. `paginate()` follows the
API's cursor and yields individual records.

The generated `trame_sdk.models` module provides `TypedDict` shapes for the
OpenAPI schemas. These are static type hints, not runtime validation.

Test keys use `api.preprod.trame.africa`; live keys use `api.trame.africa`.
Customer-session operations use the cookie returned by `openSession`; provide
the matching `session_environment` and the allowed `session_origin` for writes.

The webhook helpers verify the signature over the raw request body. For
production deduplication, pass a persistent event store with an atomic start,
expiring processing lease, fencing token, and acknowledgement after the
application side effects succeed.
