The simple library for extracting all kind of bank account transaction export files, mostly for beanhub-import to inject and generate transactions
Project description
beanhub-extract
The simple library for extracting all kind of bank account transaction export files, mostly for beanhub-import to ingest and generate transactions
Note: This project is still in early stage, still subject to rapid major changes
Why?
Have you ever wondered why each of us has to write our own different Beancount importers for the same bank again and again? Why we cannot use the same exporter for the same bank CSV file? One of the biggest problems of the original Beancount importer design is that the transaction generation logic is coupled with the extract logic, making it hard to reuse. We are addressing the problem by creating a library only for extracting bank-exported CSV files into standardized transaction structures to be processed later. Ideally, you should be able to import this library and use it to import standardized transactions from CSV files exported from any bank in the world.
Install
pip install beanhub-extract
Example
Extracting transactions from the CSV file is easy. Simply create the extractor class and make a function call on the instance object, which will return a transaction object generator. Like this:
from beanhub_extract.extractors.mercury import MercuryExtractor
with open("/path/to/my-mercury.csv", "rt") as fo:
extractor = MercuryExtractor(fo)
for txn in extractor():
print(txn)
# process your transaction here
Sponsor
A modern accounting book service based on the most popular open source version control system Git and text-based double entry accounting book software Beancount.
Transaction data object
We defined a standardized transaction data object to accommodate a transaction statement's most commonly used columns.
The data object type is a simple immutable Python dataclasses.dataclass
class.
It's defined in the beanhub_extract/data_types.py file.
Supported Formats
Currently, we only support a few banks for our own benefit. If you find any particular bank CSV file or format missing and want this library to support it, please feel free to open a PR.
Mercury - mercury
To export the CSV file, please visit the Transactions page and click "Add Filter" to limit the time range of your export, then click the "Export All" button on the right-hand side.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file beanhub_extract-0.0.8.tar.gz
.
File metadata
- Download URL: beanhub_extract-0.0.8.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.10.11 Linux/5.15.0-1056-aws
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab0117f92f255041765fc0d75cc6dcdd8baf0d4dfa47fe5188c81d68c5b09536 |
|
MD5 | 053e5e7ea19fa118d714f2fb668fd1fb |
|
BLAKE2b-256 | 7e58c50b1d142629ddfdf8b537df6a501289cfaa84693f814cb36dc9edd57c01 |
File details
Details for the file beanhub_extract-0.0.8-py3-none-any.whl
.
File metadata
- Download URL: beanhub_extract-0.0.8-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.10.11 Linux/5.15.0-1056-aws
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 938b9ff5c19ea12f830fda7a8c20f46e2317b3efa3ae8bbe95dd1fbb0797be55 |
|
MD5 | b671ab342d59da893fae4bd8d1d92227 |
|
BLAKE2b-256 | ebc5f8364d8c0587bd65bf34a51f55a17882b791a27735115f95e04485f8d12b |