Skip to main content

Quick & reliable operations csv exporter for mBank.

Project description

mbank-csv-export

Hey, if you're looking for a tool that automatically exports your mBank transactions, then you've come to the right place!

Many projects successfully attempt to parse the crappy mBank CSV operations, but few reliably automate the extraction process. I adopted a modular architecture:

mbank-export exports transaction CSV files from mBank as a string.

  • Uses Playwright for automated browser interactions.
  • Saves browser state to maintain session continuity, minimizing the need for repeated mobile authentication.

mbank-parser parses the raw transactions and converts them to a desired data format.

Installation

pip install mbank-csv-export

Auth

Set MBANK_USERNAME and MBANK_PASSWORD environment variables or quick start by running mbank --username username --password password.

CLI

# Export last month operations, parse and format as clean csv:  
mbank-export | mbank-parser

# Export raw operations data from 2024-05-01 to 2024-09-30:  
mbank-export --date-from '2024-05-01' --date-to '2024-09-30' > raw-operations.txt

# Then parse and format those raw operations into json:  
cat raw-operations.txt | mbank-parser --format json

# Or in one line:  
mbank-export --date-from '2024-05-01' --date-to '2024-09-30' | mbank-parser --format json

Python package

from datetime import date

from mbank_csv_export import (
  MBank, 
  OperationsParser, 
  Operation, 
  to_csv, 
  to_json,
)

mbank = MBank(headless=False)
mbank.login(username="1111222233334444", password="***")

csv_content: str = mbank.export_operations_csv(
    date_from=date(2024, 5, 1), 
    date_to=date(2024, 9, 30)
)

operations: list[Operation] = parse_operations(csv_content)
for operation in operations:
  print(operation)

print(to_json(operations))

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

mbank_csv_export-0.3.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

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

mbank_csv_export-0.3.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file mbank_csv_export-0.3.0.tar.gz.

File metadata

  • Download URL: mbank_csv_export-0.3.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.2 Darwin/24.0.0

File hashes

Hashes for mbank_csv_export-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1c73ca664fc898ae8174dd452c5d6fd0051bc88c30f5178211cfbcf882bb47ab
MD5 ce5ecf4857626e162efea10f73c88717
BLAKE2b-256 a0b8679d8a27e6c321aeced6b20c111948f5b57bbfebe626d691c14e32d777a3

See more details on using hashes here.

File details

Details for the file mbank_csv_export-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: mbank_csv_export-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.2 Darwin/24.0.0

File hashes

Hashes for mbank_csv_export-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 52e3cf22aafd75eef072a1ef1bfdd7f0b704d7ee2c98d2e0232ada1fb1b2873b
MD5 4971c00b21f696f277b9751c4bef4739
BLAKE2b-256 b95d16397786c9d7f9644f0dd600c939d39cc59b12ad38094a408d25080eb604

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