enable support for Groupama Banque (thanks to Willy Villard, closes #1112)

This commit is contained in:
Romain Bignon 2013-04-01 11:20:21 +02:00
commit c30057d97f
2 changed files with 19 additions and 9 deletions

View file

@ -20,7 +20,8 @@
from weboob.capabilities.bank import ICapBank, AccountNotFound
from weboob.tools.backend import BaseBackend, BackendConfig
from weboob.tools.value import ValueBackendPassword
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.value import ValueBackendPassword, Value
from .browser import GanAssurances
@ -35,12 +36,18 @@ class GanAssurancesBackend(BaseBackend, ICapBank):
VERSION = '0.g'
DESCRIPTION = u'Groupama Assurances French bank website'
LICENSE = 'AGPLv3+'
CONFIG = BackendConfig(ValueBackendPassword('login', label='Account ID', masked=False),
ValueBackendPassword('password', label='Password', regexp='\d+'))
website_choices = OrderedDict([(k, u'%s (%s)' % (v, k)) for k, v in sorted({
'espaceclient.groupama.fr': u'Groupama Banque',
'espaceclient.ganassurances.fr': u'Gan Assurances',
}.iteritems(), key=lambda (k, v): (v, k))])
CONFIG = BackendConfig(Value('website', label='Which bank', choices=website_choices, default='espaceclient.groupama.fr'),
ValueBackendPassword('login', label='Account ID', masked=False),
ValueBackendPassword('password', label='Password of account'))
BROWSER = GanAssurances
def create_default_browser(self):
return self.create_browser(self.config['login'].get(),
return self.create_browser(self.config['website'].get(),
self.config['login'].get(),
self.config['password'].get())
def iter_accounts(self):

View file

@ -28,17 +28,20 @@ __all__ = ['GanAssurances']
class GanAssurances(BaseBrowser):
PROTOCOL = 'https'
DOMAIN = 'espaceclient.ganassurances.fr'
PAGES = {'https://espaceclient.ganassurances.fr/wps/portal/login.*': LoginPage,
'https://espaceclient.ganassurances.fr/wps/myportal/TableauDeBord': AccountsPage,
'https://espaceclient.ganassurances.fr/wps/myportal/!ut.*': TransactionsPage,
PAGES = {'https://[^/]+/wps/portal/login.*': LoginPage,
'https://[^/]+/wps/myportal/TableauDeBord': AccountsPage,
'https://[^/]+/wps/myportal/!ut.*': TransactionsPage,
}
def __init__(self, website, *args, **kwargs):
self.DOMAIN = website
BaseBrowser.__init__(self, *args, **kwargs)
def is_logged(self):
return self.page is not None and not self.is_on_page(LoginPage)
def home(self):
self.location('https://espaceclient.ganassurances.fr/wps/myportal/TableauDeBord')
self.location('/wps/myportal/TableauDeBord')
def login(self):
"""