CEP
Python client library for CEP (http://www.banxico.org.mx/cep/)
Installation
pip install cepmex
Development & Testing
You can use a staging environment to test the library:
import cep
cep.configure(beta=True)
To run unit tests, use pytest.
pytest
Usage
from datetime import date
from cep import Transferencia
from cep.exc import TransferNotFoundError
try:
tr = Transferencia.validar(
fecha=date(2019, 4, 12),
clave_rastreo='CUENCA1555093850',
emisor='90646', # STP
receptor='40012', # BBVA
cuenta='012180004643051249',
monto=817, # In cents
)
pdf = tr.descargar()
with open('CUENCA1555093850.pdf', 'wb') as f:
f.write(pdf)
except TransferNotFoundError as e:
print('No se encontro la transferencia')
Validate Transfer Parameters
Use the validar method to validate a transfer with the following parameters:
Required Parameters:
fecha(datetime.date): Transfer date.clave_rastreo(str): Transfer tracking key.emisor(str): Transfer sender bank code.receptor(str): Transfer receiver bank code.cuenta(str): Transfer account number.monto(int): Transfer amount in cents.
Optional Parameters:
pago_a_banco(bool, default=False): Set toTruefor transfer types 4 and 31.
Download Transfer Data
Use the descargar method to download a transfer in one of the following formats:
PDF(default)XMLZIP
tr.descargar(formato='XML')
Exceptions
TransferNotFoundError: The transfer was not found.MaxRequestError: The maximum number of requests has been reached.CepNotAvailableError: The transfer was found, but the CEP is not available.
Metadata
Release files for cepmex 1.0.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 | |
|---|---|---|---|
| cepmex-1.0.1.tar.gz | 8.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cepmex-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.1 kB
Release files / cepmex-1.0.1.tar.gz
| Download URL | cepmex-1.0.1.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58025be8f8af68976aae948ce499b2b24e1ec4bd99de0dad554ad13e5601dce5
|
|
BLAKE2b-256 checksum How to use checksums |
a06c07d77d37d3e5aab2956ac5f2f1cf96b0867ebacbc33bb4bde929fea86212
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / cepmex-1.0.1-py3-none-any.whl
| Download URL | cepmex-1.0.1-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d78b8fd84dc9193f38e4f0361aaacb91d33345c346165c4781ee717c95adbbb3
|
|
BLAKE2b-256 checksum How to use checksums |
384191ee8b199915264557152d458e1d8489c4ddab3ce458f6abf99671808347
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|