karlicoss / monzoexport

Tool to export your Monzo transactions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tool to export your Monzo transactions

Setting up

  1. The easiest way is pip3 install --user git+https://github.com/karlicoss/monzoexport.

    Alternatively, use git clone --recursive, or git pull && git submodule update --init. After that, you can use pip3 install --editable.

  2. Create a new oauth client on monzo website.
    • pick confidentiality to be “confidential”
    • redirect uri should be https://github.com (it’s currently hardcoded in the export script)

    After creating the client, click on it in the oauth clients list.

    • add your own user id to “collaborators”, your User ID will be the same as app “Owner ID”. You might need to refresh the page to see changes.
    • take note of “Client ID” and “Client secret”, you’ll need them on the next step
  3. Log in and do an initial export

    The --first-time parameter will walk you through the login procedure:

    python3 -m monzoexport.export --token-path token.json --first-time /path/to/first-export.json
        

    After a successful export, move token.json somewhere safe, and pass it as token-path later. You won’t need to pass --first-time anymore.

    Note that after 5 minutes after login, api can only sync the last 90 days of transactions (see https://docs.monzo.com/#list-transactions for more information). Because of that it’s important to do at least one export immediately once you received the token.

Exporting

Usage:

Recommended: create secrets.py keeping your api parameters, e.g.:

token-path = "TOKEN-PATH"

After that, use:

python3 -m monzoexport.export --secrets /path/to/secrets.py

That way you type less and have control over where you keep your plaintext secrets.

Alternatively, you can pass parameters directly, e.g.

python3 -m monzoexport.export --token-path <token-path>

However, this is verbose and prone to leaking your keys/tokens/passwords in shell history.

You can also import export.py as a module and call get_json function directly to get raw JSON.

I highly recommend checking exported files at least once just to make sure they contain everything you expect from your export. If not, please feel free to ask or raise an issue!

Using data

You can use monzoexport.dal (stands for “Data Access/Abstraction Layer”) to access your exported data, even offline. I elaborate on motivation behind it here.

  • main usecase is to be imported as python module to allow for programmatic access to your data.

    You can find some inspiration in =my.= package that I’m using as an API to all my personal data.

  • to test it against your export, simply run: python3 -m monzoexport.dal --source /path/to/export
  • you can also try it interactively: python3 -m monzoexport.dal --source /path/to/export --interactive

About

Tool to export your Monzo transactions

License:MIT License


Languages

Language:Python 95.9%Language:Shell 4.1%