SDK Python del API v1 de RuralDTE — emisión de DTE ante el SII de Chile (emitir = encolar), folios/CAF, webhooks y API keys.
Project description
ruraldte (Python)
SDK Python del API v1 de RuralDTE — emisión de documentos tributarios electrónicos (DTE) ante el SII de Chile. Cero dependencias (solo stdlib).
Instalación
pip install ruraldte
Cobertura actual (MVP):
documents.emit,documents.list,documents.states, folios, emisores, webhooks y keys. El SDK TypeScript (@ruraldte/sdk) cubre además pagos, cesiones, conectores, intercambio, reportes y más — la API REST los soporta todos aunque este SDK aún no.
import os
from ruraldte import RuralDte, RuralDteError
rd = RuralDte(api_key=os.environ["RURALDTE_API_KEY"])
# Emitir = encolar (202 { "status": "queued" }). El SII confirma asíncrono.
try:
doc = rd.documents.emit({
"emisorId": "…",
"tipo": 33, # factura electrónica
"ambiente": "cert",
"receptor": {"rut": "11111111-1", "razonSocial": "ACME SpA"},
"montos": {"total": 1190, "neto": 1000, "iva": 190}, # CLP enteros
}, idempotency_key="orden-123")
print(doc["id"], doc["status"])
# Pollear el desenlace (o suscribir un webhook a dte.aceptado/dte.rechazado).
print(rd.documents.states(doc["id"]))
except RuralDteError as e:
print(e.status, e.code, e.detail, "retryable:", e.is_retryable)
Recursos: documents (emit/list/states), folios (stock/request),
emisores (list/create/upload_credential), webhooks (list/register/disable),
keys (list/create/revoke).
Config: RuralDte(api_key, base_url=…, timeout=30). La key fija el ambiente
permitido (rdte_test_* → test/cert, rdte_live_* → prod).
Docs y OpenAPI: https://ruraldte.cl/docs
Tests: python3 -m unittest discover -s tests -t .
MIT © Comunidad Rural SpA
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ruraldte-0.1.0.tar.gz.
File metadata
- Download URL: ruraldte-0.1.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8829aa544a7d1ac20c9d6b49c5ed5abae4ce79b413eaece0e255ae475765d41
|
|
| MD5 |
fe35294bd2424852ea193dd61eec550a
|
|
| BLAKE2b-256 |
613ef6465d06fd2a43d5e0e9c7de5ac34bea1cf88401e60a030bec7fb7a41f3d
|
File details
Details for the file ruraldte-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ruraldte-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0449d6c9009101d19be5a4341b199b6ef4de2b40b0b295e02e9da3f53a8f3fcb
|
|
| MD5 |
fbb05dc714c05bb9d3adbc51a0153032
|
|
| BLAKE2b-256 |
fef20aae66f7901af2be2cb7ad4adfed206b45ad2bb0f9c1562a154ac74d0d9b
|