pax_global_header 0000666 0000000 0000000 00000000064 12356015330 0014510 g ustar 00root root 0000000 0000000 52 comment=e025fb0b2040e76d68512fca33d3483aa63d925d
woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-carrefourbanque/ 0000775 0000000 0000000 00000000000 12356015330 0024210 5 ustar 00root root 0000000 0000000 woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-carrefourbanque/modules/ 0000775 0000000 0000000 00000000000 12356015330 0025660 5 ustar 00root root 0000000 0000000 woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-carrefourbanque/modules/carrefourbanque/ 0000775 0000000 0000000 00000000000 12356015330 0031044 5 ustar 00root root 0000000 0000000 __init__.py 0000664 0000000 0000000 00000001455 12356015330 0033103 0 ustar 00root root 0000000 0000000 woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-carrefourbanque/modules/carrefourbanque # -*- coding: utf-8 -*-
# Copyright(C) 2013 Romain Bignon
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see .
from .backend import CarrefourBanqueBackend
__all__ = ['CarrefourBanqueBackend']
backend.py 0000664 0000000 0000000 00000003656 12356015330 0032740 0 ustar 00root root 0000000 0000000 woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-carrefourbanque/modules/carrefourbanque # -*- coding: utf-8 -*-
# Copyright(C) 2013 Romain Bignon
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see .
from weboob.capabilities.base import find_object
from weboob.capabilities.bank import CapBank, AccountNotFound
from weboob.tools.backend import BaseBackend, BackendConfig
from weboob.tools.value import ValueBackendPassword
from .browser import CarrefourBanque
__all__ = ['CarrefourBanqueBackend']
class CarrefourBanqueBackend(BaseBackend, CapBank):
NAME = 'carrefourbanque'
MAINTAINER = u'Romain Bignon'
EMAIL = 'romain@weboob.org'
VERSION = '0.j'
DESCRIPTION = u'Carrefour Banque'
LICENSE = 'AGPLv3+'
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):
return self.create_browser(self.config['login'].get(),
self.config['password'].get())
def iter_accounts(self):
return self.browser.get_accounts_list()
def get_account(self, _id):
return find_object(self.browser.get_accounts_list(), id=_id, error=AccountNotFound)
def iter_history(self, account):
return self.browser.iter_history(account)
browser.py 0000664 0000000 0000000 00000003676 12356015330 0033036 0 ustar 00root root 0000000 0000000 woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-carrefourbanque/modules/carrefourbanque # -*- coding: utf-8 -*-
# Copyright(C) 2013 Romain Bignon
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see .
from weboob.tools.browser2 import LoginBrowser, URL, need_login
from weboob.tools.exceptions import BrowserIncorrectPassword
from .pages import LoginPage, HomePage, TransactionsPage
__all__ = ['CarrefourBanque']
class CarrefourBanque(LoginBrowser):
BASEURL = 'https://www.carrefour-banque.fr'
login = URL('/espace-client/connexion', LoginPage)
home = URL('/espace-client$', HomePage)
transactions = URL('/espace-client/carte-credit/solde-dernieres-operations.*', TransactionsPage)
def do_login(self):
"""
Attempt to log in.
Note: this method does nothing if we are already logged in.
"""
assert isinstance(self.username, basestring)
assert isinstance(self.password, basestring)
self.login.go()
self.page.enter_login(self.username)
self.page.enter_password(self.password)
if not self.home.is_here():
raise BrowserIncorrectPassword()
@need_login
def get_accounts_list(self):
self.home.stay_or_go()
return self.page.get_list()
@need_login
def iter_history(self, account):
self.location(account._link)
assert self.transactions.is_here()
return self.page.get_history(account)
favicon.png 0000664 0000000 0000000 00000002651 12356015330 0033124 0 ustar 00root root 0000000 0000000 woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-carrefourbanque/modules/carrefourbanque PNG
IHDR @ @ iq bKGD C pHYs
B(x tIME
5 6IDATx[lTE"(.!(6Rm"x!H!<`4Fd_LLH4Ƈ1QH1FQ/Xh@Qk4"Y4p9ggΙٙohYB恫ˁ߀qKC !w@u/^xʞgq q.5aq/@|80a8:i/2yOFȕY E5U3EXrȦHE`%pM_lHY%tpC_OnCgyfKS%Ou&@4yYc] ,M)`6':ajPy f31jɭ\!_ŷ"Bu:-!M,=Xr@+S'B.`kYp ꙥ<@GݚΫmUb _lUhorh2$OZYW?+qܭ1Ϩ\~a#)b !$^xxCB^@:`B~'C:=SG"#plFA` YGd-x ,w$iЂl
Cu y'G暟a0l gJK>/Eh+<.Up!5W$׀k( p[@6I
"bV9"Vw/ 'Wm
:\W4ŭ@kBi:+ј#:B"v6[5pO>VN:WVk8ZiQ\ǝ
{70k4*8͘:zK#98:K۔i2
̳$"J5??" :'
S:!,/gBSI3g9W+1:[Uq/=]P Vp\/e#gjPm{2Ӎع?dg ^Ņ{DX
,o]m^*w |xv_ƹ)$>g" mWh1Q:m؞|Tu6?(|RDI., 'u `JC
|x|:mQdlуjHBz& '&jLNr/1dK`r0mv4
y{ߐ3o]Z#oWx"RYeMc@mxx4)N; *P'yjk=u5t_BS窾4Xwmdv'@\'T|0JIt\Pe J A"Ԉ|
4pE0 IENDB` pages.py 0000664 0000000 0000000 00000004762 12356015330 0032447 0 ustar 00root root 0000000 0000000 woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-carrefourbanque/modules/carrefourbanque # -*- coding: utf-8 -*-
# Copyright(C) 2013 Romain Bignon
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see .
import re
from weboob.tools.browser2.page import HTMLPage, ListElement, ItemElement, method, LoggedPage
from weboob.tools.browser2.filters import Regexp, CleanText, CleanDecimal, Format, Link
from weboob.capabilities.bank import Account
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
__all__ = ['LoginPage', 'HomePage', 'TransactionsPage']
class LoginPage(HTMLPage):
def enter_login(self, username):
form = self.get_form(nr=0)
form['name'] = username
form.submit()
def enter_password(self, password):
form = self.get_form(nr=0)
form['pass'] = password
form.submit()
class HomePage(LoggedPage, HTMLPage):
@method
class get_list(ListElement):
item_xpath = '//div[@class="three_contenu_table"]'
class item(ItemElement):
klass = Account
obj_id = Regexp(CleanText('./div[@class="carte_col_leftcol"]/p'), r'(\d+)')
obj_label = CleanText('./div[@class="carte_col_leftcol"]/h2')
obj_balance = CleanDecimal(Format('-%s', CleanText('.//div[@class="catre_col_one"]/h2')))
obj_currency = FrenchTransaction.Currency('.//div[@class="catre_col_one"]/h2')
obj__link = Link('.//a[contains(@href, "solde-dernieres-operations")]')
class Transaction(FrenchTransaction):
PATTERNS = [(re.compile(r'^(?P.*?) (?P\d{2})/(?P\d{2})$'), FrenchTransaction.TYPE_CARD)]
class TransactionsPage(LoggedPage, HTMLPage):
@method
class get_history(Transaction.TransactionsElement):
head_xpath = '//table[@id="creditHistory"]//thead/tr/th'
item_xpath = '//table[@id="creditHistory"]/tbody/tr'
class item(Transaction.TransactionElement):
obj_id = None
obj_type = Transaction.TYPE_CARD
test.py 0000664 0000000 0000000 00000001776 12356015330 0032331 0 ustar 00root root 0000000 0000000 woob-e025fb0b2040e76d68512fca33d3483aa63d925d-modules-carrefourbanque/modules/carrefourbanque # -*- coding: utf-8 -*-
# Copyright(C) 2013 Romain Bignon
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see .
from weboob.tools.test import BackendTest
class CarrefourBanqueTest(BackendTest):
BACKEND = 'carrefourbanque'
def test_carrefourbanque(self):
l = list(self.backend.iter_accounts())
if len(l) > 0:
a = l[0]
list(self.backend.iter_history(a))