Skip to main content

CEP client library

Project description

CEP

test codecov PyPI

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 to True for transfer types 4 and 31.

Download Transfer Data

Use the descargar method to download a transfer in one of the following formats:

  • PDF (default)
  • XML
  • ZIP
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.

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

cepmex-1.0.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

cepmex-1.0.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file cepmex-1.0.0.tar.gz.

File metadata

  • Download URL: cepmex-1.0.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for cepmex-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b40659abcff12c821e1e59fbb373d498bf4c0d95a35f1f829963e35ffa338045
MD5 c9aa86b6fc7db0f5ca66e9edbee984c6
BLAKE2b-256 75cabf8189de7e99f1f860e6cc80ae58b24158b55dd1eaeccd07289b42a7f4fa

See more details on using hashes here.

File details

Details for the file cepmex-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: cepmex-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for cepmex-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 241fd9259a4ec97e2a289eeb7a6347a65dcbfadb51ca39a0ff79e1c5eae96050
MD5 70720a8e74896e85c06bb93732eada80
BLAKE2b-256 2d5bd0b23c6e427f809f5185e7aa861715494214c09a26b26b6ab46bbe7480c5

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