ecuafact 1.0.0b1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ecuafact might be problematic. Click here for more details.

@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ecuanexus
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,109 @@
1
+ Metadata-Version: 2.4
2
+ Name: ecuafact
3
+ Version: 1.0.0b1
4
+ Summary: Cliente oficial en Python del API publico de facturacion electronica Ecuafact (contrato v1).
5
+ Author: Ecuanexus
6
+ License-Expression: MIT
7
+ Project-URL: Documentation, https://docsapi.ecuafact.com/v1/guias/sdk-python
8
+ Project-URL: Homepage, https://docsapi.ecuafact.com/v1/guias/sdk-python
9
+ Keywords: ecuafact,sri,facturacion-electronica,ecuador,api,sdk
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
15
+ Requires-Python: >=3.9
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: httpx>=0.27
19
+ Requires-Dist: pydantic>=2.6
20
+ Provides-Extra: dev
21
+ Requires-Dist: pytest>=8; extra == "dev"
22
+ Dynamic: license-file
23
+
24
+ # ecuafact (Python)
25
+
26
+ Cliente oficial en Python del API publico de facturacion electronica Ecuafact (contrato v1). Cubre
27
+ autenticacion, idempotencia, reintentos y firma de webhooks. Requiere Python 3.9+.
28
+
29
+ ## Instalacion
30
+
31
+ ```bash
32
+ pip install ecuafact
33
+ ```
34
+
35
+ ## Uso
36
+
37
+ ```python
38
+ import os
39
+ from ecuafact import ComprobanteRequest, EcuafactClient, EcuafactClientOptions, InfoTributaria
40
+
41
+ client = EcuafactClient(EcuafactClientOptions(
42
+ base_address="https://staging-api.mynexusapi.com/", # sandbox; produccion: https://api.mynexusapi.com/
43
+ api_key=os.environ["ECUAFACT_API_KEY"],
44
+ identificacion="1790012345001", # solo integraciones de un RUC
45
+ ))
46
+
47
+ resultado = client.emitir(ComprobanteRequest(
48
+ origen_referencia="MiERP",
49
+ referencia_externa="FACTURA-2026-0001",
50
+ info_tributaria=InfoTributaria(
51
+ ruc="1790012345001", cod_doc="01", estab="002", pto_emi="001", secuencial="000000123"
52
+ ),
53
+ # info=..., detalles=...
54
+ ))
55
+ print(resultado.admission.id_operacion, resultado.admission.codigo)
56
+ ```
57
+
58
+ ### Multi-RUC
59
+
60
+ ```python
61
+ ruc = client.para("1790099987001")
62
+ pagina = ruc.listar_emitidos()
63
+ ```
64
+
65
+ ## Idempotencia
66
+
67
+ `idempotency_key` es opcional: si no se envia, el SDK la genera, la reutiliza en los reintentos y la
68
+ devuelve en `resultado.idempotency_key` (y en el error, como `EcuafactApiException.idempotency_key`).
69
+ Al reintentar a nivel de aplicacion **reutiliza la clave devuelta**. La correlacion de la respuesta
70
+ queda en `resultado.correlation_id` (o `EcuafactApiException.id_seguimiento` en error).
71
+
72
+ Los fallos transitorios (`408/425/429/5xx`) se reintentan con la misma clave respetando `Retry-After`;
73
+ el resto de los 4xx no.
74
+
75
+ ## Opciones
76
+
77
+ | Opcion | Default | Descripcion |
78
+ |---|---|---|
79
+ | `base_address` | — | Direccion base del API (obligatoria) |
80
+ | `api_key` | — | Credencial `X-Api-Key` (obligatoria) |
81
+ | `identificacion` | `None` | RUC por defecto (opcional) |
82
+ | `timeout` | `100.0` | Tiempo maximo por intento (segundos) |
83
+ | `user_agent` | `Ecuafact.Sdk/1.0` | User-Agent |
84
+ | `retry_transient_failures` | `True` | Reintenta `408/425/429/5xx` |
85
+ | `max_attempts` | `3` | Intentos por solicitud |
86
+ | `respect_retry_after` | `True` | Respeta `Retry-After` en `429`/`503` |
87
+ | `max_retry_delay_ms` | `60000` | Espera maxima entre reintentos |
88
+
89
+ ## Errores
90
+
91
+ Los errores del API se lanzan como `EcuafactApiException` (`codigo`, `mensaje`, `estado_http`,
92
+ `id_seguimiento`, `errores`, `idempotency_key`). Los errores locales de configuracion o transporte son
93
+ `EcuafactSdkException`.
94
+
95
+ ## Webhooks
96
+
97
+ ```python
98
+ from ecuafact import verify
99
+
100
+ valido = verify(secreto, cabecera, cuerpo_crudo, tolerance_seconds=300)
101
+ ```
102
+
103
+ ## Documentacion
104
+
105
+ - [Guia del SDK Python](https://docsapi.ecuafact.com/v1/guias/sdk-python)
106
+
107
+ ## Licencia
108
+
109
+ MIT.
@@ -0,0 +1,86 @@
1
+ # ecuafact (Python)
2
+
3
+ Cliente oficial en Python del API publico de facturacion electronica Ecuafact (contrato v1). Cubre
4
+ autenticacion, idempotencia, reintentos y firma de webhooks. Requiere Python 3.9+.
5
+
6
+ ## Instalacion
7
+
8
+ ```bash
9
+ pip install ecuafact
10
+ ```
11
+
12
+ ## Uso
13
+
14
+ ```python
15
+ import os
16
+ from ecuafact import ComprobanteRequest, EcuafactClient, EcuafactClientOptions, InfoTributaria
17
+
18
+ client = EcuafactClient(EcuafactClientOptions(
19
+ base_address="https://staging-api.mynexusapi.com/", # sandbox; produccion: https://api.mynexusapi.com/
20
+ api_key=os.environ["ECUAFACT_API_KEY"],
21
+ identificacion="1790012345001", # solo integraciones de un RUC
22
+ ))
23
+
24
+ resultado = client.emitir(ComprobanteRequest(
25
+ origen_referencia="MiERP",
26
+ referencia_externa="FACTURA-2026-0001",
27
+ info_tributaria=InfoTributaria(
28
+ ruc="1790012345001", cod_doc="01", estab="002", pto_emi="001", secuencial="000000123"
29
+ ),
30
+ # info=..., detalles=...
31
+ ))
32
+ print(resultado.admission.id_operacion, resultado.admission.codigo)
33
+ ```
34
+
35
+ ### Multi-RUC
36
+
37
+ ```python
38
+ ruc = client.para("1790099987001")
39
+ pagina = ruc.listar_emitidos()
40
+ ```
41
+
42
+ ## Idempotencia
43
+
44
+ `idempotency_key` es opcional: si no se envia, el SDK la genera, la reutiliza en los reintentos y la
45
+ devuelve en `resultado.idempotency_key` (y en el error, como `EcuafactApiException.idempotency_key`).
46
+ Al reintentar a nivel de aplicacion **reutiliza la clave devuelta**. La correlacion de la respuesta
47
+ queda en `resultado.correlation_id` (o `EcuafactApiException.id_seguimiento` en error).
48
+
49
+ Los fallos transitorios (`408/425/429/5xx`) se reintentan con la misma clave respetando `Retry-After`;
50
+ el resto de los 4xx no.
51
+
52
+ ## Opciones
53
+
54
+ | Opcion | Default | Descripcion |
55
+ |---|---|---|
56
+ | `base_address` | — | Direccion base del API (obligatoria) |
57
+ | `api_key` | — | Credencial `X-Api-Key` (obligatoria) |
58
+ | `identificacion` | `None` | RUC por defecto (opcional) |
59
+ | `timeout` | `100.0` | Tiempo maximo por intento (segundos) |
60
+ | `user_agent` | `Ecuafact.Sdk/1.0` | User-Agent |
61
+ | `retry_transient_failures` | `True` | Reintenta `408/425/429/5xx` |
62
+ | `max_attempts` | `3` | Intentos por solicitud |
63
+ | `respect_retry_after` | `True` | Respeta `Retry-After` en `429`/`503` |
64
+ | `max_retry_delay_ms` | `60000` | Espera maxima entre reintentos |
65
+
66
+ ## Errores
67
+
68
+ Los errores del API se lanzan como `EcuafactApiException` (`codigo`, `mensaje`, `estado_http`,
69
+ `id_seguimiento`, `errores`, `idempotency_key`). Los errores locales de configuracion o transporte son
70
+ `EcuafactSdkException`.
71
+
72
+ ## Webhooks
73
+
74
+ ```python
75
+ from ecuafact import verify
76
+
77
+ valido = verify(secreto, cabecera, cuerpo_crudo, tolerance_seconds=300)
78
+ ```
79
+
80
+ ## Documentacion
81
+
82
+ - [Guia del SDK Python](https://docsapi.ecuafact.com/v1/guias/sdk-python)
83
+
84
+ ## Licencia
85
+
86
+ MIT.
@@ -0,0 +1,38 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "ecuafact"
7
+ version = "1.0.0b1"
8
+ description = "Cliente oficial en Python del API publico de facturacion electronica Ecuafact (contrato v1)."
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "Ecuanexus" }]
14
+ keywords = ["ecuafact", "sri", "facturacion-electronica", "ecuador", "api", "sdk"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Intended Audience :: Developers",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3 :: Only",
20
+ "Topic :: Software Development :: Libraries :: Python Modules",
21
+ ]
22
+ dependencies = [
23
+ "httpx>=0.27",
24
+ "pydantic>=2.6",
25
+ ]
26
+
27
+ [project.urls]
28
+ Documentation = "https://docsapi.ecuafact.com/v1/guias/sdk-python"
29
+ Homepage = "https://docsapi.ecuafact.com/v1/guias/sdk-python"
30
+
31
+ [project.optional-dependencies]
32
+ dev = ["pytest>=8"]
33
+
34
+ [tool.setuptools.packages.find]
35
+ where = ["src"]
36
+
37
+ [tool.pytest.ini_options]
38
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,97 @@
1
+ """Cliente oficial del API publico Ecuafact (contrato v1)."""
2
+
3
+ from .client import EcuafactClient
4
+ from .contribuyente import EcuafactContribuyente
5
+ from .errors import EcuafactApiException, EcuafactSdkException
6
+ from .models import (
7
+ Admission,
8
+ ApiError,
9
+ BusquedaContribuyente,
10
+ CampoAdicional,
11
+ ClaveAccesoDecodificada,
12
+ Comprobante,
13
+ ComprobanteRequest,
14
+ Compensacion,
15
+ Contexto,
16
+ Contribuyente,
17
+ ContribuyenteConsulta,
18
+ Detalle,
19
+ Destinatario,
20
+ DestinoSustitutiva,
21
+ DocsSustento,
22
+ EmisionResultado,
23
+ EstadoTributario,
24
+ EstablecimientoConsulta,
25
+ EstablecimientosContribuyente,
26
+ Impuesto,
27
+ ImpuestoDocSustento,
28
+ InfoDocumento,
29
+ InfoSustitutivaGuia,
30
+ InfoTributaria,
31
+ ListadoRequest,
32
+ MaquinaFiscal,
33
+ Motivo,
34
+ Operation,
35
+ Pago,
36
+ PaginaComprobantes,
37
+ QuotaBucket,
38
+ RepresentanteLegalConsulta,
39
+ RetencionFacturaLinea,
40
+ RetencionLinea,
41
+ ReembolsoDetalle,
42
+ RubroTercero,
43
+ TipoNegociable,
44
+ ValidacionIdentificacion,
45
+ )
46
+ from .options import EcuafactClientOptions, ResolvedOptions, resolve_options
47
+ from .webhooks import sign, verify
48
+
49
+ __all__ = [
50
+ "EcuafactClient",
51
+ "EcuafactContribuyente",
52
+ "EcuafactApiException",
53
+ "EcuafactSdkException",
54
+ "EcuafactClientOptions",
55
+ "ResolvedOptions",
56
+ "resolve_options",
57
+ "sign",
58
+ "verify",
59
+ "Admission",
60
+ "ApiError",
61
+ "BusquedaContribuyente",
62
+ "CampoAdicional",
63
+ "ClaveAccesoDecodificada",
64
+ "Comprobante",
65
+ "ComprobanteRequest",
66
+ "Compensacion",
67
+ "Contexto",
68
+ "Contribuyente",
69
+ "ContribuyenteConsulta",
70
+ "Detalle",
71
+ "Destinatario",
72
+ "DestinoSustitutiva",
73
+ "DocsSustento",
74
+ "EmisionResultado",
75
+ "EstadoTributario",
76
+ "EstablecimientoConsulta",
77
+ "EstablecimientosContribuyente",
78
+ "Impuesto",
79
+ "ImpuestoDocSustento",
80
+ "InfoDocumento",
81
+ "InfoSustitutivaGuia",
82
+ "InfoTributaria",
83
+ "ListadoRequest",
84
+ "MaquinaFiscal",
85
+ "Motivo",
86
+ "Operation",
87
+ "Pago",
88
+ "PaginaComprobantes",
89
+ "QuotaBucket",
90
+ "RepresentanteLegalConsulta",
91
+ "RetencionFacturaLinea",
92
+ "RetencionLinea",
93
+ "ReembolsoDetalle",
94
+ "RubroTercero",
95
+ "TipoNegociable",
96
+ "ValidacionIdentificacion",
97
+ ]