Skip to main content

py-dgii-ecf

DGII e-CF electronic invoicing SDK for the Dominican Republic (Python).

Result-pattern (result), resilient HTTP (httpx2 + tenacity + pybreaker), and XMLDSig signing (lxml + cryptography). No hidden exceptions — every fallible call returns a Result.

Install

uv add py-dgii-ecf
# or
pip install py-dgii-ecf

Server-side only. Never load in a context that exposes private keys.

Quick start

from py_dgii_ecf import ECF, Environment, P12Reader, Signature

reader = P12Reader(password)
credentials = reader.get_key_from_file("/secure/identity.p12")
if credentials.is_err():
    raise SystemExit(credentials.unwrap_err())

ecf = ECF(credentials.unwrap(), Environment.CERT)
auth = ecf.authenticate()
if auth.is_err():
    raise SystemExit(auth.unwrap_err())

signature = Signature(credentials.unwrap().key, credentials.unwrap().cert)
signed = signature.sign_xml(xml)
if signed.is_err():
    raise SystemExit(signed.unwrap_err())

response = ecf.send_electronic_document(signed.unwrap(), "101672919E3100000001.xml")
response.map(lambda invoice: print(invoice.track_id)).map_err(
    lambda error: print(error.code, error)
)

Result pattern

result = ecf.status_track_id("some-track-id")
if result.is_ok():
    print(result.unwrap().estado)
else:
    error = result.unwrap_err()
    print(error.code, error.message)

Resilience & idempotency

  • Transient failures (network, timeout, 408/429/5xx) are retried with exponential backoff and guarded by a pybreaker circuit breaker.
  • send_electronic_document / send_summary are keyed by RNC + eNCF + SHA-256(signed XML). Provide a persistent IdempotencyStore in production.
ecf = ECF(credentials, Environment.PROD, idempotency_store=my_redis_store)

CLI

py-dgii-ecf sign invoice.xml identity.p12 --output signed.xml
py-dgii-ecf authenticate identity.p12 --environment CerteCF
py-dgii-ecf status <track-id> identity.p12 --environment CerteCF

Each command prompts for the .p12 password (--password, hidden input).

Modules

environment, types, ecf, errors, result, resilience, http, certificate, signing, transformer, reception, reconciliation, validation, utils, client, cli.

License

MIT © 2026 Deuri Vasquez

Metadata

Release files for py-dgii-ecf 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-dgii-ecf 0.10.0
File Size Uploaded Provenance Actions
py_dgii_ecf-0.10.0.tar.gz 263.3 kB Without provenance Details for py_dgii_ecf-0.10.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for py-dgii-ecf 0.10.0
File Interpreter ABI Platform Actions
py_dgii_ecf-0.10.0-py3-none-any.whl Python 3 none any Details for py_dgii_ecf-0.10.0-py3-none-any.whl

Total release size: 434.8 kB

Release files / py_dgii_ecf-0.10.0.tar.gz

Download URL py_dgii_ecf-0.10.0.tar.gz
Size 263.3 kB
Tags Source
SHA-256 checksum
How to use checksums
251981a55182d3dee8803a4f541064bf9df7a8e860599e3b77dcf7ebd8ce474f
BLAKE2b-256 checksum
How to use checksums
cac6f4af93d573936f6fbb1ffc23e8b84a2d4e238d80af6616ac4a40f6f23aae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / py_dgii_ecf-0.10.0-py3-none-any.whl

Download URL py_dgii_ecf-0.10.0-py3-none-any.whl
Size 171.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9d7ce83171c26a29d096f5bbf6099c9963cdcdf5c07112d139290ef4ce056f0
BLAKE2b-256 checksum
How to use checksums
b19a319599eef62512c2ebf3043b97c3a66dd5a0e0d5b5da1ffd591b60cccc21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for py-dgii-ecf 0.10.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page