pycurenergia
Librería Python que lee las facturas en PDF de CurEnergía (electricidad y gas)
y devuelve sus datos como objetos tipados. Todos los importes, kWh, m³ y
porcentajes son decimal.Decimal.
Proyecto no oficial: no está afiliado, respaldado ni patrocinado por CurEnergía.
Licencia MIT.
Uso
from pycurenergia import check_consistency, parse_invoice_pdf
with open("factura.pdf", "rb") as f:
invoice = parse_invoice_pdf(f.read())
print(invoice.supply, invoice.total)
print(check_consistency(invoice)) # [] si los importes cuadran
parse_invoice_pdf(data: bytes)lee un PDF;parse_invoice_text(text: str)parsea el texto ya extraído.- Errores (todos derivan de
Exception; ninguno incluye texto de la factura en su mensaje):InvoiceReadError: el PDF no se puede leer (dañado, vacío, cifrado con contraseña) o es demasiado grande (más de 10 MiB o de 20 páginas). Solo lo lanzaparse_invoice_pdf; el error original de pypdf queda en__cause__.UnsupportedInvoiceError: el documento no es una factura de luz o de gas, o es una factura rectificativa o de abono (no soportadas).InvoiceParseError(con el atributofield): falta algún dato obligatorio o no tiene el formato esperado.
check_consistency(invoice)devuelve una lista deProblem; vacía si todo cuadra.invoice.energy_price_kwhes el precio de la energía en €/kWh, oNonesi la factura no lo indica.
Publicar
El workflow .github/workflows/lib-release.yml construye y publica en PyPI al
subir una etiqueta pycurenergia-v* (por ejemplo pycurenergia-v0.1.0),
usando trusted publishing (sin tokens).
Paso manual previo, una sola vez:
- Crear la cuenta en PyPI.
- En PyPI, añadir un pending trusted publisher con estos datos:
- Proyecto:
pycurenergia - Owner:
yuuues - Repositorio:
hacs-curenergia - Workflow:
lib-release.yml - Entorno:
pypi
- Proyecto:
- Crear el entorno
pypien los ajustes del repositorio de GitHub y configurar en él required reviewers (revisores obligatorios), de modo que subir una etiqueta por sí solo no publique nada sin una aprobación manual. - Etiquetar y subir:
git tag pycurenergia-v0.1.0 && git push origin pycurenergia-v0.1.0.
Metadata
Release files for pycurenergia 0.1.0
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 |
|---|---|---|---|---|
| pycurenergia-0.1.0.tar.gz | 51.0 kB | With provenance | Details for pycurenergia-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pycurenergia-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pycurenergia-0.1.0-py3-none-any.whl |
Total release size: 66.1 kB
Release files / pycurenergia-0.1.0.tar.gz
| Download URL | pycurenergia-0.1.0.tar.gz |
|---|---|
| Size | 51.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
90f3389cf9ef0ffcdc6e9f3b94954d432b4e5cae3bd8ee600164123e3d638169
|
|
BLAKE2b-256 checksum How to use checksums |
370e3eb5556eb9150bcf83e694e441abdf42156f7a3c97bc15fb773be0f9cc7d
|
| 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 Oct 29, 2026.
Transparency logRelease files / pycurenergia-0.1.0-py3-none-any.whl
| Download URL | pycurenergia-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6555c6ff43f605030d85729517d59d517b3db78e4cf0ced3a16d0319a029613b
|
|
BLAKE2b-256 checksum How to use checksums |
c6eefa0e5e6530bc77934a38bd81dbcb2fa38f6a73c8c8b9d76addc1d2b8b189
|
| 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 Oct 29, 2026.
Transparency logSecurity for pycurenergia 0.1.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pycurenergia-0.1.0.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 Oct 29, 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.