Commit 2a4049bf authored by Romain Bignon's avatar Romain Bignon

parse link id on accounts list

parent 15c58c08
......@@ -18,6 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
"""
import re
from .base import PageBase
class Account(object):
......@@ -27,8 +29,7 @@ class Account(object):
self.label = ''
self.balance = 0.0
self.coming = 0.0
self.history_link = ''
self.coming_link = ''
self.link_id = ''
def setID(self, id):
assert isinstance(id, int)
......@@ -44,11 +45,12 @@ class Account(object):
assert isinstance(coming, float)
self.coming = coming
def setHistoryLink(self, link): self.history_link = link
def setComingLink(self, link): self.coming_link = link
def setLinkID(self, link): self.link_id = link
class AccountsList(PageBase):
LINKID_REGEXP = re.compile(".*ch4=(\w+).*")
def loaded(self):
pass
......@@ -67,6 +69,9 @@ class AccountsList(PageBase):
a = td.getElementsByTagName('a')
label = a[0].firstChild.data
account.setLabel(label)
m = self.LINKID_REGEXP.match(a[0].getAttribute('href'))
if m:
account.setLinkID(m.group(1))
elif td.getAttribute('headers').startswith('Solde'):
a = td.getElementsByTagName('a')
balance = a[0].firstChild.data
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment