Python Bindings¶
The Python package wraps the fatoora-ffi shared library via cffi.
Notes¶
- Errors are raised as typed exceptions mapped from FFI error codes (see
FfiErrorKind). - Modules mirror the Rust core layout:
fatoora.config,fatoora.csr,fatoora.invoice, andfatoora.sign. - Invoice builder timestamps are strings in ZATCA ISO UTC format (
YYYY-MM-DDTHH:MM:SSZ), and country/currency codes are validated strings.
Signed Invoice Metadata¶
SignedInvoice exposes additional getters for auditing/debugging:
- signature()
- public_key()
- cert_hash()
- signed_props_hash()
- signing_time()
signing_time() returns a string in YYYY-MM-DDTHH:MM:SS (UTC).
Example¶
from fatoora.invoice import parse_signed_invoice_xml
# signed_xml_path = "path/to/signed_invoice.xml"
signed_xml = signed_xml_path.read_text(encoding="utf-8")
signed = parse_signed_invoice_xml(signed_xml)
qr = signed.qr()
hash_b64 = signed.hash_base64()
signature = signed.signature()
See also: C/C++ Bindings