support loan history
This commit is contained in:
parent
5ffd892a3d
commit
88da52a57a
2 changed files with 24 additions and 12 deletions
|
|
@ -37,6 +37,8 @@ class CreditMutuelBrowser(BaseBrowser):
|
||||||
'https://www.creditmutuel.fr/.*/fr/banque/situation_financiere.cgi': AccountsPage,
|
'https://www.creditmutuel.fr/.*/fr/banque/situation_financiere.cgi': AccountsPage,
|
||||||
'https://www.creditmutuel.fr/.*/fr/banque/espace_personnel.aspx': UserSpacePage,
|
'https://www.creditmutuel.fr/.*/fr/banque/espace_personnel.aspx': UserSpacePage,
|
||||||
'https://www.creditmutuel.fr/.*/fr/banque/mouvements.cgi.*' : OperationsPage,
|
'https://www.creditmutuel.fr/.*/fr/banque/mouvements.cgi.*' : OperationsPage,
|
||||||
|
'https://www.creditmutuel.fr/.*/fr/banque/nr/nr_devbooster.aspx.*' : OperationsPage,
|
||||||
|
'https://www.creditmutuel.fr/.*/fr/banque/operations_carte\.cgi.*' : OperationsPage,
|
||||||
'https://www.creditmutuel.fr/.*/fr/banque/BAD.*' : InfoPage,
|
'https://www.creditmutuel.fr/.*/fr/banque/BAD.*' : InfoPage,
|
||||||
'https://www.creditmutuel.fr/.*/fr/banque/.*Vir.*' : TransfertPage
|
'https://www.creditmutuel.fr/.*/fr/banque/.*Vir.*' : TransfertPage
|
||||||
}
|
}
|
||||||
|
|
@ -95,6 +97,9 @@ class CreditMutuelBrowser(BaseBrowser):
|
||||||
#operations_count = 0
|
#operations_count = 0
|
||||||
l_ret = []
|
l_ret = []
|
||||||
while (page_url):
|
while (page_url):
|
||||||
|
if page_url.startswith('/'):
|
||||||
|
self.location(page_url)
|
||||||
|
else:
|
||||||
self.location('https://%s/%s/fr/banque/%s' % (self.DOMAIN, self.currentSubBank, page_url))
|
self.location('https://%s/%s/fr/banque/%s' % (self.DOMAIN, self.currentSubBank, page_url))
|
||||||
#for page_operation in self.page.get_history(operations_count):
|
#for page_operation in self.page.get_history(operations_count):
|
||||||
# operations_count += 1
|
# operations_count += 1
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,9 @@ class AccountsPage(BasePage):
|
||||||
account = Account()
|
account = Account()
|
||||||
account.label = u"%s"%first_td.find('a').text.strip()
|
account.label = u"%s"%first_td.find('a').text.strip()
|
||||||
account.link_id = first_td.find('a').get('href', '')
|
account.link_id = first_td.find('a').get('href', '')
|
||||||
|
if account.link_id.startswith('POR_SyntheseLst'):
|
||||||
|
continue
|
||||||
|
|
||||||
account.id = first_td.find('a').text.split(' ')[0]+first_td.find('a').text.split(' ')[1]
|
account.id = first_td.find('a').text.split(' ')[0]+first_td.find('a').text.split(' ')[1]
|
||||||
s = tr.getchildren()[2].text
|
s = tr.getchildren()[2].text
|
||||||
if s.strip() == "":
|
if s.strip() == "":
|
||||||
|
|
@ -76,19 +79,24 @@ class OperationsPage(BasePage):
|
||||||
def get_history(self):
|
def get_history(self):
|
||||||
index = 0
|
index = 0
|
||||||
for tr in self.document.getiterator('tr'):
|
for tr in self.document.getiterator('tr'):
|
||||||
first_td = tr.getchildren()[0]
|
tds = tr.getchildren()
|
||||||
if first_td.attrib.get('class', '') == 'i g' or first_td.attrib.get('class', '') == 'p g':
|
if len(tds) < 4:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if tds[0].attrib.get('class', '') == 'i g' or \
|
||||||
|
tds[0].attrib.get('class', '') == 'p g' or \
|
||||||
|
tds[0].attrib.get('class', '').endswith('_c1 c _c1'):
|
||||||
operation = Transaction(index)
|
operation = Transaction(index)
|
||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
d = first_td.text.strip().split('/')
|
d = tds[0].text.strip().split('/')
|
||||||
operation.date = date(*reversed([int(x) for x in d]))
|
operation.date = date(*reversed([int(x) for x in d]))
|
||||||
|
|
||||||
operation.raw = u"%s"%tr.getchildren()[2].text.replace('\n',' ').strip()
|
operation.raw = tds[-3].text.replace('\n',' ').strip()
|
||||||
if len(tr.getchildren()[3].text) > 2:
|
if tds[-1].text is not None and len(tds[-1].text) > 2:
|
||||||
s = tr.getchildren()[3].text
|
s = tds[-1].text.strip()
|
||||||
elif len(tr.getchildren()[4].text) > 2:
|
elif tds[-1].text is not None and len(tds[-2].text) > 2:
|
||||||
s = tr.getchildren()[4].text
|
s = tds[-2].text.strip()
|
||||||
else:
|
else:
|
||||||
s = "0"
|
s = "0"
|
||||||
balance = u''
|
balance = u''
|
||||||
|
|
@ -103,4 +111,3 @@ class OperationsPage(BasePage):
|
||||||
def next_page_url(self):
|
def next_page_url(self):
|
||||||
""" TODO pouvoir passer à la page des opérations suivantes """
|
""" TODO pouvoir passer à la page des opérations suivantes """
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue