SDK
Python SDK
Official Python SDK for SwiftProof. Supports Python 3.9 and above with full type hints.
Installation
terminal
pip install swiftproof
Initialisation
Python
import os from swiftproof import SwiftProof sp = SwiftProof(api_key=os.environ["SWIFTPROOF_API_KEY"])
Create a chain
Python
chain = sp.chains.create( title="Order #4821 — Lekki Phase 1", actors=[ {"event": "packed", "actor": "Kitchen"}, {"event": "collected", "actor": "Rider — Emeka"}, {"event": "delivered", "actor": "Rider — Emeka"}, ], metadata={"order_id": "4821"}, ) print(chain.chain_id) print(chain.tracking_url)
Verify a chain
Python
proof = sp.chains.verify("sp_ch_a96fec076ffd44f4") if proof.tampered: raise Exception("Chain integrity check failed") for step in proof.trail: print(step.event, step.confirmed_at, step.location)
Async support
Python
from swiftproof import AsyncSwiftProof sp = AsyncSwiftProof(api_key=os.environ["SWIFTPROOF_API_KEY"]) chain = await sp.chains.create(title=..., actors=[...])
Requirements
- Python 3.9 or later
- Dependencies:
httpx,pydantic