{ "info": { "author": "Tom Hennigan", "author_email": "tomhennigan@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7" ], "description": "# monzo-fs\n\nmonzo-fs is a [FUSE](https://github.com/libfuse/libfuse) file system that allows you to walk through a [Monzo](http://getmonzo.co.uk) account and associated transactions as if they were files and folders.\n\nmonzo-fs is:\n\n* **alpha quality**: it works for me but ymmv, it might break as Monzo change their API or for other random reasons.\n* **simple**: it roughly follows the Monzo API's structure to make your account easy to navigate.\n* **powerful**: using the shell tools you know and love you can slice and dice all the information from your Monzo account and create compelling demos.\n* **read only**: this is not a huge limitation *imho*, and not something I'm likely to address in the near future, but being able to upload receipt images with drag-and-drop would be neat.\n* **a personal project**: this is not something related to my professional employment, or something I have copious time to work on and extend.\n\nmonzo-fs builds upon the [Monzo API](https://getmonzo.co.uk/docs/), and makes use of some other excellent open source projects such as (but not limited to) [fusepy](https://github.com/terencehonles/fusepy), [FUSE](https://github.com/libfuse/libfuse), [rfc3339](https://pypi.python.org/pypi/rfc3339) and [iso8601](https://pypi.python.org/pypi/iso8601) libraries.\n\n## tl;dr\n\nYou need a [Monzo developer account](https://developers.getmonzo.co.uk/) and [your own oauth client](https://developers.getmonzo.co.uk/apps/new) with `http://localhost:1234` as a \"Redirect URL\".\n\n**Terminal 1 (install fuse, install monzo-fs, mount)**\n\n```\n$ brew install fuse\n$ pip install monzo-fs\n$ monzo-fs /tmp/monzo --client_id= --client_secret=\n.. Follow the instructions on screen and then in your browser ..\n```\n\n**Terminal 2 (explore)**\n\n```\n$ ls /tmp/monzo\nacc_00009Aq4VDixoGFnIxcBmr\n\n$ ls /tmp/monzo/acc_00009Aq4VDixoGFnIxcBmr/transactions/2016/08/ | head\ntx_00009Aq4fq7rt647A5pWLp\ntx_00009Aq6sLNlhcLnU9MDar\ntx_00009Aq7I54SyEEcv5LaUb\ntx_00009Aq8QMKOnDp8DaZ5KD\ntx_00009Aq9nVdkRA4XqxiQV7\ntx_00009AqFGWd8Knhd5o5EDB\ntx_00009AqFXAUHugn7U6PiLZ\ntx_00009AqFxqpP7AZZH3ybb7\ntx_00009AqFxyKrCcmLc8meOH\ntx_00009AqG0e3D4pITZTntvl\n\n$ ls /tmp/monzo/acc_00009Aq4VDixoGFnIxcBmr/transactions/2016/08/tx_00009Aq4fq7rt647A5pWLp/\naccount_balance category dedupe_id json metadata settled\naccount_id counterparty description local_amount notes updated\namount created id local_currency originator\nattachments currency is_load merchant scheme\n\n$ cat /tmp/monzo/acc_00009Aq4VDixoGFnIxcBmr/transactions/2016/08/tx_00009Aq4fq7rt647A5pWLp/category\nmonzo\n\n$ cat /tmp/monzo/acc_00009Aq4VDixoGFnIxcBmr/transactions/2016/08/tx_00009Aq4fq7rt647A5pWLp/amount\n100.00\n\n$ cat /tmp/monzo/acc_00009Aq4VDixoGFnIxcBmr/transactions/2016/08/tx_00009Aq4fq7rt647A5pWLp/is_load\nTrue\n```\n\n## Getting started\n\nYou will first need to install FUSE. Mac users `brew install fuse` is an easy option, Linux users should enjoy something as simple as `apt-get install fuse` and I have no idea how this (or anything) works on Windows.\n\nOnce you have fuse installed:\n\n1. Create a [Monzo developer account](https://developers.getmonzo.co.uk/).\n2. Create a [new oauth client](https://developers.getmonzo.co.uk/apps/new) with `http://localhost:1234/` listed as a \"Redirect URL\". Note the client id and secret (you need them later).\n3. Install monzo-fs: `pip install monzo-fs`\n4. Run monzo-fs: `monzo-fs /tmp/monzo --client_id= --client_secret=`.\n5. Run through the oauth dance (click the link in terminal, put in your email, click the link in your email, go back to terminal).\n6. \ud83c\udf89 You're good to go, monzo-fs is mounted on `/tmp/monzo`! \ud83c\udf89\n\n## Config\n\nmonzo-fs stores state between starts in `~/.monzofs`. This file contains a valid oauth token so you don't have to constantly re-authorize everytime you restart the program.\n\n## Examples\n\nSome random examples to get you started/excited. Basically it's possible to explore your transaction history in a pretty meaningful way by looking at it as a file system. monzo-fs is designed to be relatively efficient so you don't have to be (e.g. we cache slow requests like listing transactions) but not overly agressive so data is relatively fresh (e.g. most caches live a few minutes).\n\n### Retrieve your balance\n\n```\n$ ls -l /tmp/monzo/acc_00009Aq4VDixoGFnIxcBmr/balance/\ntotal 24\n-r--r--r-- 0 root wheel 6 1 Jan 1970 balance\n-r--r--r-- 0 root wheel 4 1 Jan 1970 currency\n-r--r--r-- 0 root wheel 7 1 Jan 1970 spend_today\n\n$ cat /tmp/monzo/acc_00009Aq4VDixoGFnIxcBmr/balance/balance\n41.44\n\n$ cat /tmp/monzo/acc_00009Aq4VDixoGFnIxcBmr/balance/spend_today\n-55.69\n```\n\n### Print the notes from a specific transaction\n\n```\n$ cat /tmp/monzo/acc_00009Aq4VDixoGFnIxcBmr/transactions/2015/08/tx_00008zIcpb1TB4yeIFXMzx/notes\nSalmon sandwich \ud83c\udf5e\n```\n\n### Print the number of transactions per day in a given month\n\n```\n$ cat /tmp/monzo/acc_00009Aq4VDixoGFnIxcBmr/transactions/2016/08/*/created | cut -d T -f 1 | cut -d - -f 3 | sort | uniq -c\n 17 01\n 4 02\n 4 03\n 7 04\n 4 05\n 7 06\n 5 07\n 5 08\n 1 09\n 3 10\n 3 11\n 5 12\n 7 13\n 4 14\n 1 15\n 1 16\n 6 17\n```\n\n### Print a graph of your spending over a given month\n\nThis one needs a shell script to be readable ;)\n\n```sh\n#!/bin/sh\nfor account in \"$(ls -1 /tmp/monzo/)\"; do\n # For each account...\n \n # 1) Create and truncate a file to hold date/balance pairs.\n touch \"/tmp/monzo-balance-${account}\"\n > \"/tmp/monzo-balance-${account}\"\n\n # 2) Loop through all transactions in 2016/08 and get the created time and balance.\n for txn in \"/tmp/monzo/${account}/transactions/2016/08/\"*; do\n # Print out \"date time balance\" records.\n created=\"$(cat \"${txn}/created\" | cut -d . -f 1)\"\n balance=\"$(cat \"${txn}/account_balance\")\"\n echo \"${created} ${balance}\" >> /tmp/monzo-balance-${account}\n done \n\n # 3) Plot as a graph using gnuplot.\n gnuplot << __EOF\n set terminal png\n set output '/tmp/monzo-balance-${account}.png'\n set xdata time\n set format x \"%m/%d\"\n set timefmt \"%Y-%m-%dT%H:%M:%S\"\n plot \"/tmp/monzo-balance-${account}\" using 1:2 with linespoints\n__EOF\n\n # 4) Profit?\n rm -f \"/tmp/monzo-balance-${account}\"\n open \"/tmp/monzo-balance-${account}.png\"\ndone\n```\n\n**Example result:**\n\n![img](http://i.imgur.com/stASKCZ.png)\n\n## FAQ\n\n### Can this spend my monzough?\n\nNot at the moment (the Monzo API is read only). If [Monzo change this](https://trello.com/c/BwKL2zRy/31-initiate-payments-via-api) and the default oauth scope provides access to initiate payments then `monzo-fs` (or tokens granted by it) could theoretically do this.\n\n### Is this safe to use?\n\nMaybe, hopefully, probably not. I use it, you should make up your own mind. It's alpha.\n\n### What permissions are files/folders given?\n\nFiles/folders have root:root as the owner (`{uid,gid} = 0`) and are world readable/listable.\n\n### How do I unmount?\n\nEasiest option is to `^C` the `monzo-fs` process. If you can't find it `pkill -f monzo-fs` might do it. Finally you can `umount -f /tmp/monzo` to kill the mount, but it's likely the `monzo-fs` process will hang around as a zombie.\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/tomhennigan/monzo-fs", "keywords": null, "license": "Apache 2.0", "maintainer": null, "maintainer_email": null, "name": "monzo-fs", "package_url": "https://pypi.org/project/monzo-fs/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/monzo-fs/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/tomhennigan/monzo-fs" }, "release_url": "https://pypi.org/project/monzo-fs/0.1.3/", "requires_dist": null, "requires_python": null, "summary": "A FUSE file system for Monzo bank.", "version": "0.1.3" }, "last_serial": 2304762, "releases": { "0.1.3": [ { "comment_text": "", "digests": { "md5": "f73b164065af9524ca13be201e33f8d4", "sha256": "2fbdd9c40188bf810599e323c60421497085789078b394801821a5a5b85a614c" }, "downloads": -1, "filename": "monzo-fs-0.1.3.tar.gz", "has_sig": false, "md5_digest": "f73b164065af9524ca13be201e33f8d4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12876, "upload_time": "2016-08-25T21:36:33", "url": "https://files.pythonhosted.org/packages/d6/98/8c8a9efeaef1107fef7f44b51e28a851c1b900852f218f80a4d64d46f750/monzo-fs-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f73b164065af9524ca13be201e33f8d4", "sha256": "2fbdd9c40188bf810599e323c60421497085789078b394801821a5a5b85a614c" }, "downloads": -1, "filename": "monzo-fs-0.1.3.tar.gz", "has_sig": false, "md5_digest": "f73b164065af9524ca13be201e33f8d4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12876, "upload_time": "2016-08-25T21:36:33", "url": "https://files.pythonhosted.org/packages/d6/98/8c8a9efeaef1107fef7f44b51e28a851c1b900852f218f80a4d64d46f750/monzo-fs-0.1.3.tar.gz" } ] }