banes (banorte email scraper) is a library for scraping transaction emails from Banorte.
The library includes scrapers of different types of emails collected over a two year period.
You can take a look here in order to see which emails have an scraper implemented already.
The parsing of the dates is up to you due to the weird formats Banorte uses. In my opinion those dates are not very accurate. I recommend taking a look at the timestamp of the email when it arrived in your inbox, and then comparing the two dates in order to see which one is better for your use case.
- Install the package.
pip install git+ssh://[email protected]/ramomar/banes.git
- Require the scraper and use it!
import base64
from banes import banorte_email
with open('email-in-b64') as email:
html = base64.b64decode(email.read())
print(banorte_email.scrape(html))
ExpenseRecord(
source='FAST_TRANSFER_EMAIL',
type='EXPENSE',
note='Transferencias Rápidas | Pago de una cosa',
operation_date='20/Jul/2020 22:14:36 horas',
receiver=Receiver(
name='Ana',
bank='BANAMEX'
),
amount='5.00',
extra_amounts=[
ExtraAmount(
name='fee',
amount='3.00',
tax='0.48'
)
]
)
You can also independently import the scrapers listed here.
Record type | Description |
---|---|
INCOME | A record that represents an income. |
EXPENSE | A record that represents an expense. |
ACCOUNT_OPERATION | A record that represents an account operation log (change of NIP, virtual card limit modification, etc). |
You can get more details on the structure of the records here.
In order to run tests you might do pytest
.
In order to run type checking you might do mypy banes
.