Logo Lanfrica

axialhash/tuna-sdk-python

Domain:

digital infrastructure

Record type:

software
Creator:
axi
Host:
Python SDK for Tuna — Ethiopian receipt verification # tuna-sdk Python SDK for Tuna — Ethiopian receipt verification. ## Install ```bash pip install tuna-sdk # or from GitHub pip install git+github.com ``` ## Quick Start ```python from tuna_sdk import Tuna tuna = Tuna() # Verify a CBE receipt result = tuna.verify(bank="CBETETAA", ref="FT25211G11JQ", extras={"account": "12345678"}) print(result.verified) # True print(result.receipt.amount) # "5000.00" # Auto-detect from a URL result = tuna.verify(bank="auto", ref="apps.cbe.com.et...") # Parse a receipt image parsed = tuna.parse_image("receipt.png") print(parsed.bank, parsed.ref, parsed.amount) # List supported banks for bank in tuna.info(): print(f"{bank.name} — {bank.status}") # Batch verify from tuna_sdk import BatchItem results = tuna.verify_batch([ BatchItem(bank="CBETETAA", ref="FT25211G11JQ", extras={"account": "12345678"}), BatchItem(bank="telebirr", ref="CHQ0FJ403O"), ]) print(f"{results.verified}/{results.total} verified") ``` ## Error Handling ```python from tuna_sdk import Tuna, BankNotSupportedError, RefError, EndpointError tuna = Tuna() try: result = tuna.verify(bank="XYZ", ref="FT123") except BankNotSupportedError as e: print(f"Bank not supported: {e}") print(f"Did you mean: {e.suggestion}") # "Did you mean CBETETAA?" except RefError as e: print(f"Bad reference: {e}") except EndpointError as e: print(f"Bank endpoint down: {e}") ``` ## Async Usage ```python from tuna_sdk import AsyncTuna async with AsyncTuna() as tuna: result = await tuna.verify(bank="CBETETAA", ref="FT25211G11JQ") print(result.verified) ``` ## API Reference ### `Tuna(base_url?, timeout?, headers?)` | Param | Default | Description | |-------|---------|-------------| | `base_url` | `api.txna.me` | API endpoint | | `timeout` | `30` | Request timeout in seconds | | `headers` | `{}` | Extra HTTP headers | ### Methods | Method | Returns | Description | |--------|---------|-------------| | `verify(bank, ref, …

Languages