Skip to main content

Quick & reliable operations csv exporter for mBank.

Project description

mbank-csv-export

Hey, if you're looking for a tool to automagically export transactions from mBank 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 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, parse_raw_operations, operations_to_csv

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[dict] = parse_raw_operations(csv_content)
operations_csv: str = operations_to_csv(operations)
print(operations_csv)

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.2.0.tar.gz (5.6 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.2.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mbank_csv_export-0.2.0.tar.gz
  • Upload date:
  • Size: 5.6 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.2.0.tar.gz
Algorithm Hash digest
SHA256 b39e21833eddf04697f879e4a9029e2818019139320e34412a6b1798ba962ef3
MD5 7e6abafa5e73c2e351ebf0f9f54476b4
BLAKE2b-256 4d937c647409c0f10af20d7eaaccd6543dc1c95033a83b34bab3190a774fb625

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mbank_csv_export-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e0cc5f7101baded4fd9c7a27cd33c99f10c28ebd78d6c794bc5d86705c4fbcc9
MD5 cc24e34a734e5e3cd5a4ad5b0e01b20b
BLAKE2b-256 25b78a54ff3837aad5b1f18f59fd954575b72f7215f8be6a5beb6b735100ab95

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