init
This commit is contained in:
commit
e2d9f4f2de
3 changed files with 22 additions and 0 deletions
3
.env.sample
Normal file
3
.env.sample
Normal file
|
@ -0,0 +1,3 @@
|
|||
UP_TOKEN=up:yeah:
|
||||
UP_ACCOUNT=
|
||||
OUTPUT=account.md
|
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
.venv
|
||||
.env
|
||||
*.pyc
|
||||
__pycache__
|
15
get_transactions.py
Executable file
15
get_transactions.py
Executable 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)
|
Loading…
Reference in a new issue