Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/karlicoss/monzoexport
- Owner: karlicoss
- License: mit
- Created: 2019-12-25T13:31:30.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-03-04T20:16:45.000Z (10 months ago)
- Last Synced: 2024-05-30T01:15:17.845Z (7 months ago)
- Topics: backup, data-liberation, export, monzo
- Language: Python
- Homepage:
- Size: 49.8 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.org
- License: LICENSE
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 step3. *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: