- The easiest way is
pip3 install --user git+https://github.com/karlicoss/monzoexport
.Alternatively, use
git clone --recursive
, orgit pull && git submodule update --init
. After that, you can usepip3 install --editable
. - 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
- 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 astoken-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.
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!
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