Prometeo Python API Client

This is the official python library for the Prometeo API
Documentation
Complete client documentation is available at Read the docs
Installation
Prerequisites
- Python version 3.7
- An API Key (contact us to get one!)
Install package
$ pip install prometeo
Quick Start
Get your key
Go to your dashboard, there you'll find your API key. Use it to instantiate the client:
from prometeo import Client
client = Client('<YOUR_API_KEY>', environment='sandbox')
The environment argument is either sandbox for the sandbox or production for the production environment.
Listing movements
The following example logs in to the sandboxed bank and retrieves a list of movements
from datetime import datetime
session = client.banking.new_session()
session = session.login(provider='test', username='12345', password='gfdsa')
accounts = session.get_accounts()
account = accounts[0]
print(account.number, ' - ', account.name)
movements = account.get_movements(datetime(2019, 2, 1), datetime(2019, 2, 2))
for movement in movements:
print(movement.detail, movement.debit, movement.credit)
Listing credit card movements
cards = session.get_credit_cards()
card = cards[0]
print(card.number, ' - ', card.name)
movements = card.get_movements('USD', datetime(2019, 2, 1), datetime(2019, 2, 2))
for movement in movements:
print(movement.detail, movement.debit, movement.credit)
Listing all available banks
providers = client.banking.get_providers()
for provider in providers:
print(provider.name, provider.country)
Account Validation API
Validating Account in MX
result = client.account_validation.validate(
account_number="999000000000000014",
country_code="MX"
)
CURP API
Checking the existence of a curp
from prometeo.curp import exceptions
curp = 'ABCD12345EFGH'
try:
result = client.curp.query(curp)
except exceptions.CurpError as e:
print("CURP does not exist:", e.message)
Looking for a CURP by person
from datetime import datetime
from prometeo.curp import exceptions, Gender, State
curp = 'ABCD12345EFGH'
state = State.SINALOA
birthdate = datetime(1988, 3, 4)
name = 'JOHN'
first_surname = 'DOE'
last_surname = 'PONCE'
gender = Gender.MALE
try:
result = client.curp.reverse_query(
state, birthdate, name, first_surname, last_surname, gender
)
except exceptions.CurpError as e:
print("CURP does not exist:", e.message)
DIAN API
Log in
Supply the NIT to log in as a company:
from prometeo.dian import DocumentType
session = client.dian.login(
nit='098765',
document_type=DocumentType.CEDULA_CIUDADANIA,
document='12345',
password='test_password',
)
Or omit it to log in as a person:
from prometeo.dian import DocumentType
session = client.dian.login(
document_type=DocumentType.CEDULA_CIUDADANIA,
document='12345',
password='test_password',
)
Get the data
Company info:
session.get_company_info()
Balances:
session.get_balances()
Rent declaration:
session.get_rent_declaration(2018)
VAT declaration:
from prometeo.dian import Periodicity, QuartlerlyPeriod
session.get_vat_declaration(2019, Periodicity.QUARTERLY, QuartlerlyPeriod.JANUARY_APRIL)
Numeration:
from datetime import datetime
from prometeo.dian import NumerationType
session.get_numeration(NumerationType.Authorization, datetime(2019, 1, 1), datetime(2019, 5, 1))
Retentions:
from prometeo.dian import MonthlyPeriod
session.get_retentions(2019, MonthlyPeriod.NOVEMBER)
SAT API
Login in
from prometeo.sat import LoginScope
session = client.sat.login(
rfc='ABCD1234EFGH',
password='password',
scope=LoginScope.CFDI,
)
Work with CFDI bills
List emitted and received bills
from prometeo.sat import BillStatus
emitted_bills = session.get_emitted_bills(
date_start=datetime(2020, 1, 1),
date_end=datetime(2020, 2, 1),
status=BillStatus.ANY,
)
received_bills = session.get_received_bills(
year=2020,
month=1,
status=BillStatus.ANY,
Bulk download of bills
from prometeo.sat import BillStatus
download_requests = session.download_emitted_bills(
date_start=datetime(2020, 1, 1),
date_end=datetime(2020, 2, 1),
status=BillStatus.ANY,
)
for request in download_requests:
download = request.get_download()
content = download.get_file().read()
Download acknowledgements
from prometeo.sat import Motive, DocumentType, Status, SendType
acks = session.get_acknowledgement(
year=2020,
month_start=1,
month_end=2,
motive=Motive.ALL,
document_type=DocumentType.ALL,
status=Status.ALL,
send_type=SendType.ALL,
)
for ack in acks:
download = ack.download().get_file()
How to run tests
We are using the tox testing library tox
To run the tests implemented inside the tests folder simply run the following command inside your project:
tox
This will run tests for both python 2 and 3. To restrict the result to only python3 use:
tox -e py3
How to generate HTML documentation
Inside your terminal, move to the /docs folder (there should be a file named Makefile), run the following command:
make html
This will generate the HTML files inside the docs/_build folder.
Notes
-
Do not install
pip install prometeopackage inside the same virtual enviroment where this project is running as it may cause conflicts while running unittest. -
To use the local files insted of the production source code, install it with
pip install prometeo --no-index --find-links file:///srv/pkg/mypackage
License
Metadata
Release files for prometeo 2.0.10
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 |
|---|---|---|---|---|
| prometeo-2.0.10.tar.gz | 49.5 kB | Without provenance | Details for prometeo-2.0.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| prometeo-2.0.10-py3-none-any.whl | Python 3 | none | any | Details for prometeo-2.0.10-py3-none-any.whl |
Total release size: 113.6 kB
Release files / prometeo-2.0.10.tar.gz
| Download URL | prometeo-2.0.10.tar.gz |
|---|---|
| Size | 49.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5ba1413fd315833833bb9bc5d16d7736f6f849f042c27897dbda1259647848cb
|
|
BLAKE2b-256 checksum How to use checksums |
fe400be7425a654e4a8e1bb6197871613ae5e20307091e6a137e270d28ae9f44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / prometeo-2.0.10-py3-none-any.whl
| Download URL | prometeo-2.0.10-py3-none-any.whl |
|---|---|
| Size | 64.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0c38818714774e8bad32de04b37a53a172a2dc8684e234e3a72746dd4763be17
|
|
BLAKE2b-256 checksum How to use checksums |
2553e431fbb338c1f05bbcad77f5bd4ace9db2e8e9206acbddc1a45326a9d67a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for prometeo 2.0.10
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.