Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/karlicoss/monzoexport

Tool to export your Monzo transactions
https://github.com/karlicoss/monzoexport

backup data-liberation export monzo

Last synced: 2 months ago
JSON representation

Tool to export your Monzo transactions

Awesome Lists containing this project

README

        

#+begin_src python :results drawer :exports results
import monzoexport.export as E; return E.make_parser().prog
#+end_src

#+RESULTS:
:results:
Tool to export your Monzo transactions
:end:

* 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 [[https://developers.monzo.com/apps/home][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

#+begin_src python :results drawer :exports results
import monzoexport.export as E; return E.make_parser().epilog
#+end_src

#+RESULTS:
:results:

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

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!

:end:

* Using data

#+begin_src python :results drawer :exports results
import monzoexport.exporthelpers.dal_helper as D; return D.make_parser().epilog
#+end_src

#+RESULTS:
:results:

You can use =monzoexport.dal= (stands for "Data Access/Abstraction Layer") to access your exported data, even offline.
I elaborate on motivation behind it [[https://beepb00p.xyz/exports.html#dal][here]].

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

You can find some inspiration in [[https://beepb00p.xyz/mypkg.html][=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~

:end: