Metadata-Version: 2.1
Name: mbank-csv-export
Version: 0.1.0
Summary: Quick & reliable operations csv exporter for mBank.
Author: Marcin Tyszkiewicz
Author-email: 56219944+mtyszkiewicz@users.noreply.github.com
Requires-Python: >=3.12,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: playwright (>=1.44.0,<2.0.0)
Requires-Dist: pydantic-settings (>=2.3.1,<3.0.0)
Requires-Dist: python-dateutil (>=2.9.0.post0,<3.0.0)
Description-Content-Type: text/markdown

# mbank-csv-export

Many projects successfully attempt to parse the crappy mBank CSV operations, but few reliably automate the extraction process. 

This library does only one thing - 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.

# Usage

## Library
```python
from datetime import date

from mbank_csv_export import MBank

mbank = MBank(headless=False)
mbank.login(username="1111222233334444", password="***")
csv_content: str = mbank.export_operations_csv(
    date_from=date(2023, 6, 1), 
    date_to=date(2024, 6, 1)
)
print(csv_content)
```

## CLI
```sh
> mbank --help
usage: mbank [-h] [--headless] [--username USERNAME] [--password PASSWORD] [--log-level {ERROR,WARN,INFO,DEBUG}] [--date-from DATE_FROM] [--date-to DATE_TO] [--verbose]

options:
  -h, --help            show this help message and exit
  --headless
  --username USERNAME   or set MBANK_USERNAME env variable
  --password PASSWORD   or set MBANK_PASSWORD env variable
  --log-level {ERROR,WARN,INFO,DEBUG}
                        or set MBANK_LOG_LEVEL env variable
  --date-from DATE_FROM
                        format YYYY-MM-DD, defaults to date 1 month ago.
  --date-to DATE_TO     format YYYY-MM-DD, defaults to date today.
  --verbose
```

## Contribute
Pull requests and issues are highly appreciated. To add your changes:
  1) Fork the repository.
  2) Create a new branch for your feature or bugfix (git checkout -b feature-name).
  3) Commit your changes (git commit -m 'Add some feature').
  4) Push to the branch (git push origin feature-name).
  5) Open a pull request on GitHub.

