radiankore
Librería Python de Deikore SAS para consultar servicios de DIAN y emitir eventos RADIAN con certificado digital PFX/P12. Python >=3.13, clientes asíncrono y síncrono, licencia MIT.
| Estado | |
|---|---|
| Documentación | |
| Calidad y pruebas | |
| Paquete |
Rendimiento observado con DIAN
Consultas reales de eventos en producción, realizadas el 28 de octubre de 2026 con radiankore 0.7.0. Medianas del tiempo total de lote, tres repeticiones por configuración y dos workers de procesamiento:
| CUFEs por lote | Concurrencia 5 | Concurrencia 10 | Concurrencia 20 |
|---|---|---|---|
| 100 | 8,56 s | 4,64 s | 3,27 s |
| 500 | 44,29 s | 21,51 s | 11,42 s |
| 1.000 | 89,58 s | 44,78 s | 22,41 s |
Las 14.400 consultas terminaron sin excepciones, timeouts ni reintentos. Son observaciones de estos ensayos, no una capacidad garantizada de DIAN. Los clientes se crearon por muestra, sin calentamiento; carga del certificado y cierre se midieron aparte. La guía de benchmarks conserva percentiles, condiciones, JSON originales y diferencias entre muestras, incluido un p99 de 4,57 s. Las comparaciones locales separan resultados simulados y objetivos pendientes.
Instalación
pip install radiankore
# Con uv:
uv add radiankore
Consulte la instalación para compilar conjuntamente las dependencias de firma cuando sea necesario.
Consultar eventos con AsyncDianClient
Guarde este ejemplo en un archivo Python y sustituya la ruta y el CUFE por sus datos. La consulta contacta el ambiente de producción seleccionado explícitamente.
import asyncio
from getpass import getpass
from radiankore import AsyncDianClient, Environment
async def query_events(cufe, password):
client = await AsyncDianClient.from_file(
"/ruta/segura/certificado.pfx",
password=password,
environment=Environment.PRODUCTION,
)
async with client:
return await client.get_invoice_events(cufe)
if __name__ == "__main__":
result = asyncio.run(
query_events("CUFE-DE-LA-FACTURA", getpass("Contraseña del certificado: "))
)
print(result.is_valid, result.status_code)
for event in result.events:
print(event.id, event.code, event.description, event.date, event.time)
El certificado se carga fuera del event loop y async with cierra los recursos.
La guía async
incluye lotes con iter_queries, correlación por CUFE, errores individuales y
un puente para obtener resultados desde código síncrono.
Preparar y enviar eventos con await
Este ejemplo recibe un modelo público de evento y un RadianSoftware construidos
por el consumidor. La
guía async
incluye la construcción completa de un acuse 030 con datos ficticios.
from radiankore import AsyncDianClient, Environment
async def send_event(pfx_bytes, password, event, software):
client = await AsyncDianClient.from_pfx(
pfx_bytes,
password=password,
environment=Environment.HABILITATION,
)
async with client:
prepared = await client.prepare_radian_event(event=event, software=software)
# Retain and inspect this exact artifact before authorizing transmission.
result = await client.send_radian_event(prepared)
return prepared, result
La preparación firma y comprime localmente. El envío transmite el ZIP original
una sola vez y exige el mismo ambiente. Ante un fallo después de iniciar el
envío, conserve el artefacto: el resultado puede ser desconocido y no debe
reenviarse automáticamente. None no confirma aceptación.
Los ejemplos por familia describen los modelos de eventos 030–051. La librería no genera facturas.
Operaciones disponibles
Ambos clientes comparten argumentos y modelos de respuesta; las operaciones de
AsyncDianClient se esperan con await.
| Método | Operación DIAN | Resultado |
|---|---|---|
get_numbering_range(account_code=..., account_code_t=..., software_code=...) |
GetNumberingRange |
Rangos de numeración autorizados y clave técnica |
get_exchange_emails() |
GetExchangeEmails |
Registros del CSV del directorio de correos |
get_status(track_id) |
GetStatus |
Estado de validación y payloads decodificados |
get_invoice_events(cufe) |
GetStatusEvent |
Eventos asociados a una factura |
get_acquirer(identification_type=..., identification_number=...) |
GetAcquirer |
Nombre y correo del adquiriente |
get_document_info(uuid) |
GetDocumentInfo |
Información, estados, eventos y notas del documento |
get_reference_notes(track_id) |
GetReferenceNotes |
Notas referenciadas y motivos por línea |
get_xml_by_document_key(document_key) |
GetXmlByDocumentKey |
XML original del documento como bytes |
prepare_radian_event(event=..., software=...) |
Local | XML firmado, CUDE y ZIP de los eventos 030–051 |
send_radian_event(prepared) |
SendEventUpdateStatus |
Emisión del evento RADIAN preparado |
Los resultados utilizan dataclasses inmutables y campos opcionales cuando
corresponda. AsyncDianClient reutiliza sus pools durante su vida y admite
consultas concurrentes, con límites configurables y sin reintentos automáticos.
La revisión XML incorpora correcciones de endosos, pagos y mandato. En 045,
InvoicePaymentEvent recibe ahora payer en lugar de payers; consulte la
migración de pagos
y el informe de conformidad.
Desde 0.7.1 hay límites activos de 16 MiB para SOAP, 64 MiB para ZIP y 128 MiB
para CSV descomprimido, configurables mediante DianResponseLimits. Consulte
cómo ampliarlos o desactivarlos por campo.
Cliente síncrono
DianClient conserva su API y sus defaults. Para llamadas síncronas directas:
from radiankore import DianClient, Environment
def query_events_sync(pfx_bytes, password, cufe):
with DianClient.from_pfx(
pfx_bytes,
password=password,
environment=Environment.PRODUCTION,
reuse_connections=True,
) as client:
return client.get_invoice_events(cufe)
Consulte la API y
rendimiento y ciclo de vida.
El cliente sync cierra por operación salvo que se active su reutilización opcional;
el cliente async se cierra mediante async with o await client.aclose().
La documentación completa incluye contratos, modelos, errores y ejemplos. Para contribuir, consulte CONTRIBUTING.
Metadata
Release files for radiankore 0.7.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| radiankore-0.7.1.tar.gz | 178.8 kB | With provenance | Details for radiankore-0.7.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| radiankore-0.7.1-py3-none-any.whl | Python 3 | none | any | Details for radiankore-0.7.1-py3-none-any.whl |
Total release size: 302.3 kB
Release files / radiankore-0.7.1.tar.gz
| Download URL | radiankore-0.7.1.tar.gz |
|---|---|
| Size | 178.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
285561ff516e3f470f35767889b6ed81b9afa04c7a17ba283d293724be1cb532
|
|
BLAKE2b-256 checksum How to use checksums |
0148c46fc1838cd65cd0e199302a5fe950e37592e3cfba16e2f96ccbb25471ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.
Transparency logRelease files / radiankore-0.7.1-py3-none-any.whl
| Download URL | radiankore-0.7.1-py3-none-any.whl |
|---|---|
| Size | 123.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
213ae14b0154ab2e1d586ca8d08effe15ce9b8ba6240638e39fa7d144c9e86a3
|
|
BLAKE2b-256 checksum How to use checksums |
a7bb8991541695c16ac0c90328a851556cddcb982b9d79c89b8680740b2f288f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.
Transparency logSecurity for radiankore 0.7.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for radiankore-0.7.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.
Transparency logA 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.