fetch: add account balance reports to the output log and keep balance information in cache files ~enleth

master
Kasownik 2017-06-22 04:00:20 +02:00
parent 2ef84a4f20
commit 102057f490
1 changed files with 12 additions and 1 deletions

View File

@ -531,6 +531,8 @@ if __name__ == "__main__":
assert False, "unhandled option"
lock()
balances = {}
if cached:
print "[i] Cached run - will not connect to the bank"
@ -568,6 +570,10 @@ if __name__ == "__main__":
cachefile.write(history)
cachefile.close()
history_logs[account_number] = history
balances[account_number] = (account["available_balance"],account["currency"])
balancefile = open(CACHE_DIR+"/balance-"+account_number,'w')
balancefile.write("{} {}\n".format(account["available_balance"],account["currency"]))
balancefile.close()
parsed = {}
stats = {}
@ -587,7 +593,12 @@ if __name__ == "__main__":
if noaction:
print "[i] --no-action set, skipping row {}".format(row)
session.commit()
if balances:
print "[i] Account balances:"
for account_number,v in balances.items():
balance,currency = v
print "\t{}: {} {}".format(account_number, balance, currency)
print "[i] Done: ", stats
release()
#print f.create_report().read()