Commit e175d515 authored by Martin Sicot's avatar Martin Sicot Committed by Romain Bignon

[groupama] New AV page handled

AV page was't in our links, hence we did not handle it.
parent bbef05ce
Pipeline #1796 failed with stages
in 2 minutes and 34 seconds
......@@ -17,13 +17,14 @@
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <>.
import re
from weboob.browser import LoginBrowser, URL, need_login
from weboob.exceptions import BrowserIncorrectPassword
from import Account
from weboob.capabilities.base import empty
from .pages import LoginPage, AccountsPage, TransactionsPage, AVAccountPage, AVHistoryPage, FormPage, IbanPage
from .pages import LoginPage, AccountsPage, TransactionsPage, AVAccountPage, AVHistoryPage, FormPage, IbanPage, AvJPage
__all__ = ['GroupamaBrowser']
......@@ -39,8 +40,10 @@ class GroupamaBrowser(LoginBrowser):
accounts = URL('/wps/myportal/TableauDeBord', AccountsPage)
transactions = URL('/wps/myportal/!ut', TransactionsPage)
av_account_form = URL('/wps/myportal/assurancevie/', FormPage)
av_account = URL('https://secure-rivage.(ganassurances|ganpatrimoine|groupama).fr/contratVie.rivage.syntheseContratEparUc.gsi', AVAccountPage)
av_account = URL('https://secure-rivage.(ganassurances|ganpatrimoine|groupama).fr/contratVie.rivage.syntheseContratEparUc.gsi',
'/front/vie/epargne/contrat/(.*)', AVAccountPage)
av_history = URL('https://secure-rivage.(?P<website>.*).fr/contratVie.rivage.mesOperations.gsi', AVHistoryPage)
av_secondary = URL('/api/ecli/vie/contrats/(?P<id_contrat>.*)', AvJPage)
def __init__(self, *args, **kwargs):
super(GroupamaBrowser, self).__init__(*args, **kwargs)
......@@ -68,6 +71,13 @@ class GroupamaBrowser(LoginBrowser):
if self.av_account_form.is_here():
account.balance, account.currency =
# New page where some AV are stored
elif "front/vie/" in account._link:
link ='contrat\/(.+)-Groupama', account._link)
if link:
account.balance, account.currency =
if account.balance or not balance:
if account.type != Account.TYPE_LIFE_INSURANCE and need_iban:
......@@ -25,7 +25,7 @@ import ast
from decimal import Decimal
from weboob.browser.pages import HTMLPage, pagination, LoggedPage, FormNotFound
from weboob.browser.pages import HTMLPage, pagination, LoggedPage, FormNotFound, JsonPage
from weboob.browser.elements import method, TableElement, ItemElement
from weboob.browser.filters.standard import Env, CleanDecimal, CleanText, Date, Regexp, Eval
from weboob.browser.filters.html import Attr, Link, TableCell
......@@ -33,6 +33,7 @@ from weboob.browser.filters.javascript import JSVar
from import Account, Investment
from weboob.capabilities.base import NotAvailable
from import FrenchTransaction
from weboob.browser.filters.json import Dict
class LoginPage(HTMLPage):
......@@ -217,6 +218,13 @@ class AVAccountPage(LoggedPage, HTMLPage):
obj_code_type = Investment.CODE_TYPE_ISIN
class AvJPage(LoggedPage, JsonPage):
def get_av_balance(self):
balance = CleanDecimal(Dict('montant'))(self.doc)
currency = "EUR"
return balance, currency
class AVHistoryPage(LoggedPage, HTMLPage):
class get_av_history(TableElement):
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