This commit is contained in:
alydev 2024-12-09 12:41:21 +10:00
commit 4f8cf7535c
3 changed files with 22 additions and 0 deletions

3
.env.sample Normal file
View file

@ -0,0 +1,3 @@
UP_TOKEN=up:yeah:
UP_ACCOUNT=
OUTPUT=account.md

4
.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
.venv
.env
*.pyc
__pycache__

15
get_transactions.py Executable file
View file

@ -0,0 +1,15 @@
from dotenv import load_dotenv
import pandas as pd
from upbankapi import Client, NotAuthorizedException
from io import StringIO
from os import environ
load_dotenv()
client = Client()
transactions = client.account(environ["UP_ACCOUNT"]).transactions()
f = StringIO("created_at,settled_at,amount,description\n" +
"\n".join(f"{t.created_at},{t.settled_at},{t.amount},{t.long_description}" for t in transactions))
df = pd.read_csv(f)
with open(environ["OUTPUT"], "w") as outp:
df.to_html(buf=outp, index=False)