fix carrefourbanque to use new website (and rewrite it with browser2)

This commit is contained in:
Romain Bignon 2014-04-26 12:01:09 +02:00
commit 73cb61fec7
3 changed files with 59 additions and 154 deletions

View file

@ -18,6 +18,7 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.capabilities.base import find_object
from weboob.capabilities.bank import ICapBank, AccountNotFound
from weboob.tools.backend import BaseBackend, BackendConfig
from weboob.tools.value import ValueBackendPassword
@ -35,8 +36,8 @@ class CarrefourBanqueBackend(BaseBackend, ICapBank):
VERSION = '0.i'
DESCRIPTION = u'Carrefour Banque'
LICENSE = 'AGPLv3+'
CONFIG = BackendConfig(ValueBackendPassword('login', label=u'Référent client', masked=False),
ValueBackendPassword('password', label=u"Code d'accès", regexp='\d+'))
CONFIG = BackendConfig(ValueBackendPassword('login', label=u'Votre Identifiant Internet', masked=False),
ValueBackendPassword('password', label=u"Code d'accès", regexp=u'\d+'))
BROWSER = CarrefourBanque
def create_default_browser(self):
@ -44,26 +45,10 @@ class CarrefourBanqueBackend(BaseBackend, ICapBank):
self.config['password'].get())
def iter_accounts(self):
with self.browser:
return self.browser.get_accounts_list()
return self.browser.get_accounts_list()
def get_account(self, _id):
with self.browser:
account = self.browser.get_account(_id)
if account:
return account
else:
raise AccountNotFound()
return find_object(self.browser.get_accounts_list(), id=_id, error=AccountNotFound)
def iter_history(self, account):
with self.browser:
for tr in self.browser.iter_history(account):
if not tr._coming:
yield tr
def iter_coming(self, account):
with self.browser:
for tr in self.browser.iter_history(account):
if tr._coming:
yield tr
return self.browser.iter_history(account)