[backend creditmutuel] rename crmut to creditmutuel
'list' command ok 'history' command ok
This commit is contained in:
parent
aedb56a639
commit
bbb6dfa84b
3 changed files with 54 additions and 4 deletions
|
|
@ -59,5 +59,5 @@ class CreditMutuelBackend(BaseBackend, ICapBank):
|
|||
return iter([])
|
||||
|
||||
def iter_history(self, account):
|
||||
""" TODO Not supported yet """
|
||||
return iter([])
|
||||
for history in self.browser.get_history(account):
|
||||
yield history
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
|
||||
|
||||
from .pages import LoginPage, LoginErrorPage, AccountsPage
|
||||
from .pages import LoginPage, LoginErrorPage, AccountsPage, OperationsPage
|
||||
|
||||
|
||||
__all__ = ['CreditMutuelBrowser']
|
||||
|
|
@ -32,7 +32,8 @@ class CreditMutuelBrowser(BaseBrowser):
|
|||
USER_AGENT = BaseBrowser.USER_AGENTS['wget']
|
||||
PAGES = {'https://www.creditmutuel.fr/groupe/fr/index.html': LoginPage,
|
||||
'https://www.creditmutuel.fr/groupe/fr/identification/default.cgi': LoginErrorPage,
|
||||
'https://www.creditmutuel.fr/cmdv/fr/banque/situation_financiere.cgi': AccountsPage
|
||||
'https://www.creditmutuel.fr/cmdv/fr/banque/situation_financiere.cgi': AccountsPage,
|
||||
'https://www.creditmutuel.fr/cmdv/fr/banque/mouvements.cgi.*' : OperationsPage
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
@ -68,6 +69,19 @@ class CreditMutuelBrowser(BaseBrowser):
|
|||
|
||||
return None
|
||||
|
||||
def get_history(self, account):
|
||||
page_url = account.link_id
|
||||
#operations_count = 0
|
||||
while (page_url):
|
||||
self.location('https://%s/cmdv/fr/banque/%s' % (self.DOMAIN, page_url))
|
||||
#for page_operation in self.page.get_history(operations_count):
|
||||
# operations_count += 1
|
||||
# yield page_operation
|
||||
for op in self.page.get_history():
|
||||
yield op
|
||||
page_url = self.page.next_page_url()
|
||||
|
||||
|
||||
#def get_coming_operations(self, account):
|
||||
# if not self.is_on_page(AccountComing) or self.page.account.id != account.id:
|
||||
# self.location('/NS_AVEEC?ch4=%s' % account.link_id)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
from weboob.tools.browser import BasePage
|
||||
from weboob.capabilities.bank import Account
|
||||
from weboob.capabilities.bank import Operation
|
||||
|
||||
class LoginPage(BasePage):
|
||||
def login(self, login, passwd):
|
||||
|
|
@ -51,3 +52,38 @@ class AccountsPage(BasePage):
|
|||
l.append(account)
|
||||
#raise NotImplementedError()
|
||||
return l
|
||||
|
||||
def next_page_url(self):
|
||||
""" TODO pouvoir passer à la page des comptes suivante """
|
||||
return 0
|
||||
|
||||
class OperationsPage(BasePage):
|
||||
def get_history(self):
|
||||
index = 0
|
||||
for tr in self.document.getiterator('tr'):
|
||||
first_td = tr.getchildren()[0]
|
||||
if first_td.attrib.get('class', '') == 'i g' or first_td.attrib.get('class', '') == 'p g':
|
||||
operation = Operation(index)
|
||||
index += 1
|
||||
operation.date = first_td.text
|
||||
operation.label = tr.getchildren()[2].text.replace('\n',' ')
|
||||
if len(tr.getchildren()[3].text) > 2:
|
||||
s = tr.getchildren()[3].text
|
||||
elif len(tr.getchildren()[4].text) > 2:
|
||||
s = tr.getchildren()[4].text
|
||||
else:
|
||||
s = "0"
|
||||
print "s"+s+"::"+operation.label+"::"
|
||||
balance = u''
|
||||
for c in s:
|
||||
if c.isdigit() or c == "-":
|
||||
balance += c
|
||||
if c == ',':
|
||||
balance += '.'
|
||||
operation.amount = float(balance)
|
||||
yield operation
|
||||
|
||||
def next_page_url(self):
|
||||
""" TODO pouvoir passer à la page des opérations suivantes """
|
||||
return 0
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue