From 8e415ee75ca73b4d5f07cab41f2177eba6c3eed0 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Mon, 4 Jun 2018 20:56:06 +0200 Subject: [PATCH] Use currency values in transactions. --- fulbank/fsb.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fulbank/fsb.py b/fulbank/fsb.py index ef413ae..33346da 100644 --- a/fulbank/fsb.py +++ b/fulbank/fsb.py @@ -1,6 +1,7 @@ import json, http.cookiejar, binascii, time, pickle from urllib import request, parse from bs4 import BeautifulSoup as soup +from . import currency soupify = lambda cont: soup(cont, "html.parser") apibase = "https://online.swedbank.se/TDE_DAP_Portal_REST_WEB/api/" @@ -53,12 +54,12 @@ class transaction(object): self._data = data @property - def amount(self): return float(resolve(self._data, ("amount",))) + def value(self): return currency.currency.get(resolve(self._data, ("currency",))).parse(resolve(self._data, ("amount",))) @property def message(self): return resolve(self._data, ("details", "message")) def __repr__(self): - return "#" % (self.amount, self.message) + return "#" % (self.value, self.message) class account(object): def __init__(self, sess, id, idata): -- 2.11.0