Commit 7e9b2c2e authored by Simon Rochwerg's avatar Simon Rochwerg Committed by Romain Bignon

[groupama] adds iban scraping

Closes: 6482@zendesk
parent aa1cf84a
......@@ -23,7 +23,7 @@ from weboob.exceptions import BrowserIncorrectPassword
from import Account
from weboob.capabilities.base import empty
from .pages import LoginPage, AccountsPage, TransactionsPage, AVAccountPage, AVHistoryPage, FormPage
from .pages import LoginPage, AccountsPage, TransactionsPage, AVAccountPage, AVHistoryPage, FormPage, IbanPage
__all__ = ['GroupamaBrowser']
......@@ -35,6 +35,7 @@ class GroupamaBrowser(LoginBrowser):
login = URL('/wps/portal/login',
'/wps/portal/inscription', LoginPage)
iban = URL('/wps/myportal/!ut/(.*)/\?paramNumCpt=(.*)', IbanPage)
accounts = URL('/wps/myportal/TableauDeBord', AccountsPage)
transactions = URL('/wps/myportal/!ut', TransactionsPage)
av_account_form = URL('/wps/myportal/assurancevie/', FormPage)
......@@ -57,7 +58,7 @@ class GroupamaBrowser(LoginBrowser):
# And to get history (or other) we need to use the link again but the link works only once.
# So we get balance only for iter_account to not use the new link each time.
def get_accounts_list(self, balance=True):
def get_accounts_list(self, balance=True, need_iban=False):
accounts = []
for account in
......@@ -69,6 +70,11 @@ class GroupamaBrowser(LoginBrowser):
account.balance, account.currency =
if account.balance or not balance:
if account.type != Account.TYPE_LIFE_INSURANCE and need_iban:
if self.transactions.is_here():
account.iban =
return accounts
......@@ -45,10 +45,10 @@ class GroupamaModule(Module, CapBankWealth):
def iter_accounts(self):
return self.browser.get_accounts_list()
return self.browser.get_accounts_list(need_iban=True)
def get_account(self, _id):
return find_object(self.browser.get_accounts_list(), id=_id, error=AccountNotFound)
return find_object(self.browser.get_accounts_list(need_iban=True), id=_id, error=AccountNotFound)
def iter_history(self, account):
return self.browser.get_history(account)
......@@ -110,7 +110,6 @@ class AccountsPage(LoggedPage, HTMLPage):
if accounts and accounts[-1].label == account.label and account.type == Account.TYPE_PEA:
self.logger.warning('%s seems to be a duplicate of %s, skipping', account, accounts[-1])
return accounts
......@@ -162,6 +161,19 @@ class TransactionsPage(HTMLPage):
return None
return re.sub('[ \t\r\n]+', '', a.attrib['href'])
def go_iban(self):
js_event = Attr("//a[@class='rib']", 'onclick')(self.doc)
m ="envoyer(.*);", js_event)
iban_params = ast.literal_eval(
link = iban_params[1]
class IbanPage(LoggedPage, HTMLPage):
def get_iban(self):
return CleanText('(//b[contains(text(), "IBAN")])[1]/../text()')(self.doc)
class AVAccountPage(LoggedPage, HTMLPage):
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