Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ruraldte-0.1.2.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ruraldte-0.1.2-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file ruraldte-0.1.2.tar.gz.

File metadata

  • Download URL: ruraldte-0.1.2.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for ruraldte-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8ecedb65432cb155fb0fb3688da9c763de8b52cb376294a1b1c02600c7ebc16c
MD5 cd3c0ca0b281b5934a8a02984a700cf3
BLAKE2b-256 fb217a714afa2e40f38e325cf034ce8de6bd5be565bda5b784cc34e5ebe24804

See more details on using hashes here.

File details

Details for the file ruraldte-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: ruraldte-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for ruraldte-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f7b2c63750b85f0210d0b53b00d7ebf6accf95b327ee8f797fda16684270c102
MD5 2fdf0746c9a5c0fee22db0bbe2d74048
BLAKE2b-256 5d39397c0719761ab7b2b071d32298eff7b09993ef3452e3f780a19fbe6bf61c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page