cleanup and update AUTHORS

This commit is contained in:
Romain Bignon 2012-11-22 22:19:43 +01:00
commit dfbcda1cac
5 changed files with 41 additions and 44 deletions

View file

@ -53,6 +53,9 @@ Xavier Guerrin <xavier@tuxfamily.org>
Gabriel Kerneis <kerneis@pps.jussieu.fr> Gabriel Kerneis <kerneis@pps.jussieu.fr>
* Boursorama module maintainer. * Boursorama module maintainer.
Kevin Pouget <kevin.pouget@st.com>
* CreditCooperatif module maintainer.
Gilles Quenot <gilles.quenot@gmail.com> Gilles Quenot <gilles.quenot@gmail.com>
* Fortuneo module maintainer. * Fortuneo module maintainer.

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright(C) 2012 Kevin Pouget, based on Romain Bignon work # Copyright(C) 2012 Kevin Pouget
# #
# This file is part of weboob. # This file is part of weboob.
# #
@ -20,7 +20,6 @@
from weboob.capabilities.bank import ICapBank, AccountNotFound from weboob.capabilities.bank import ICapBank, AccountNotFound
from weboob.tools.backend import BaseBackend, BackendConfig from weboob.tools.backend import BaseBackend, BackendConfig
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.value import ValueBackendPassword, Value from weboob.tools.value import ValueBackendPassword, Value
from .browser import CreditCooperatif from .browser import CreditCooperatif
@ -36,18 +35,18 @@ class CreditCooperatifBackend(BaseBackend, ICapBank):
VERSION = '0.e' VERSION = '0.e'
DESCRIPTION = u'Credit Cooperatif French bank website' DESCRIPTION = u'Credit Cooperatif French bank website'
LICENSE = 'AGPLv3+' LICENSE = 'AGPLv3+'
auth_type = {"weak" : "Code confidentiel", auth_type = {"weak" : "Code confidentiel",
"strong": "Sesame"} "strong": "Sesame"}
CONFIG = BackendConfig(Value('auth_type', label='Authentication type', choices=auth_type, default="strong"), CONFIG = BackendConfig(Value('auth_type', label='Authentication type', choices=auth_type, default="strong"),
ValueBackendPassword('login', label='Account ID', masked=False), ValueBackendPassword('login', label='Account ID', masked=False),
ValueBackendPassword('pin', label='One time pin')) ValueBackendPassword('password', label='Password or one time pin'))
BROWSER = CreditCooperatif BROWSER = CreditCooperatif
def create_default_browser(self): def create_default_browser(self):
return self.create_browser(self.config['login'].get(), return self.create_browser(self.config['login'].get(),
self.config['pin'].get(), self.config['password'].get(),
self.config['auth_type'].get() == "strong") strong_auth=self.config['auth_type'].get() == "strong")
def iter_accounts(self): def iter_accounts(self):
with self.browser: with self.browser:
@ -65,7 +64,7 @@ class CreditCooperatifBackend(BaseBackend, ICapBank):
def iter_history(self, account): def iter_history(self, account):
with self.browser: with self.browser:
return self.browser.get_history(account) return self.browser.get_history(account)
def iter_coming(self, account): def iter_coming(self, account):
with self.browser: with self.browser:
return self.browser.get_coming(account) return self.browser.get_coming(account)

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright(C) 2012 Romain Bignon # Copyright(C) 2012 Kevin Pouget
# #
# This file is part of weboob. # This file is part of weboob.
# #
@ -17,9 +17,6 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
import urllib
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
from .pages import LoginPage, AccountsPage, TransactionsPage, ComingTransactionsPage from .pages import LoginPage, AccountsPage, TransactionsPage, ComingTransactionsPage
@ -37,18 +34,17 @@ class CreditCooperatif(BaseBrowser):
'https://www.coopanet.com/banque/cpt/cpt/situationcomptes.do\?lnkReleveAction=X&numeroExterne=.*': TransactionsPage, 'https://www.coopanet.com/banque/cpt/cpt/situationcomptes.do\?lnkReleveAction=X&numeroExterne=.*': TransactionsPage,
'https://www.coopanet.com/banque/cpt/cpt/relevecompte.do\?tri_page=.*': TransactionsPage, 'https://www.coopanet.com/banque/cpt/cpt/relevecompte.do\?tri_page=.*': TransactionsPage,
'https://www.coopanet.com/banque/cpt/cpt/situationcomptes.do\?lnkOpCB=X&numeroExterne=.*': ComingTransactionsPage 'https://www.coopanet.com/banque/cpt/cpt/situationcomptes.do\?lnkOpCB=X&numeroExterne=.*': ComingTransactionsPage
} }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
#catch and remove the third/last arg self.strong_auth = kwargs.pop('strong_auth', False)
self.strong_auth = args[-1] BaseBrowser.__init__(self, *args, **kwargs)
BaseBrowser.__init__(self, *args[:-1], **kwargs)
def home(self): def home(self):
self.location("/banque/sso/") self.location("/banque/sso/")
assert self.is_on_page(LoginPage) assert self.is_on_page(LoginPage)
def is_logged(self): def is_logged(self):
return not self.is_on_page(LoginPage) return not self.is_on_page(LoginPage)
@ -86,13 +82,13 @@ class CreditCooperatif(BaseBrowser):
return a return a
return None return None
def get_history(self, account): def get_history(self, account):
self.location('/banque/cpt/cpt/situationcomptes.do?lnkReleveAction=X&numeroExterne='+ account.id) self.location('/banque/cpt/cpt/situationcomptes.do?lnkReleveAction=X&numeroExterne='+ account.id)
while 1: while 1:
assert self.is_on_page(TransactionsPage) assert self.is_on_page(TransactionsPage)
for tr in self.page.get_history(): for tr in self.page.get_history():
yield tr yield tr
@ -101,7 +97,7 @@ class CreditCooperatif(BaseBrowser):
return return
self.location(next_url) self.location(next_url)
def get_coming(self, account): def get_coming(self, account):
self.location('/banque/cpt/cpt/situationcomptes.do?lnkOpCB=X&numeroExterne='+ account.id) self.location('/banque/cpt/cpt/situationcomptes.do?lnkOpCB=X&numeroExterne='+ account.id)

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright(C) 2012 Kevin Pouget, based on Romain Bignon work # Copyright(C) 2012 Kevin Pouget
# #
# This file is part of weboob. # This file is part of weboob.
# #
@ -18,9 +18,9 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from urlparse import urlsplit, parse_qsl
from decimal import Decimal from decimal import Decimal
import re import re
import time
from weboob.tools.browser import BasePage from weboob.tools.browser import BasePage
from weboob.capabilities.bank import Account from weboob.capabilities.bank import Account
@ -33,7 +33,7 @@ class LoginPage(BasePage):
def login(self, login, pin, strong_auth): def login(self, login, pin, strong_auth):
form_nb = 1 if strong_auth else 0 form_nb = 1 if strong_auth else 0
indentType = "RENFORCE" if strong_auth else "MDP" indentType = "RENFORCE" if strong_auth else "MDP"
self.browser.select_form(name='loginCoForm', nr=form_nb) self.browser.select_form(name='loginCoForm', nr=form_nb)
self.browser['codeUtil'] = login self.browser['codeUtil'] = login
self.browser['motPasse'] = pin self.browser['motPasse'] = pin
@ -43,13 +43,13 @@ class LoginPage(BasePage):
class AccountsPage(BasePage): class AccountsPage(BasePage):
ACCOUNT_TYPES = {u'COMPTE NEF': Account.TYPE_CHECKING} ACCOUNT_TYPES = {u'COMPTE NEF': Account.TYPE_CHECKING}
CPT_ROW_ID = 0 CPT_ROW_ID = 0
CPT_ROW_NAME = 1 CPT_ROW_NAME = 1
CPT_ROW_NATURE = 2 CPT_ROW_NATURE = 2
CPT_ROW_BALANCE = 3 CPT_ROW_BALANCE = 3
CPT_ROW_ENCOURS = 4 CPT_ROW_ENCOURS = 4
def is_error(self): def is_error(self):
for par in self.document.xpath('//p[@class=acctxtnoirlien]'): for par in self.document.xpath('//p[@class=acctxtnoirlien]'):
if par.text is not None and u"La page demandée ne peut pas être affichée." in par.text: if par.text is not None and u"La page demandée ne peut pas être affichée." in par.text:
@ -60,20 +60,20 @@ class AccountsPage(BasePage):
def get_list(self): def get_list(self):
for trCompte in self.document.xpath('//table[@id="compte"]/tbody/tr'): for trCompte in self.document.xpath('//table[@id="compte"]/tbody/tr'):
tds = trCompte.findall('td') tds = trCompte.findall('td')
account = Account() account = Account()
account.id = tds[self.CPT_ROW_ID].text.strip() account.id = tds[self.CPT_ROW_ID].text.strip()
account.label = tds[self.CPT_ROW_NAME].text.strip() account.label = tds[self.CPT_ROW_NAME].text.strip()
account_type_str = "".join([td.text for td in tds[self.CPT_ROW_NATURE].xpath('.//td[@class="txt"]')]).strip() account_type_str = "".join([td.text for td in tds[self.CPT_ROW_NATURE].xpath('.//td[@class="txt"]')]).strip()
account.type = self.ACCOUNT_TYPES.get(account_type_str, Account.TYPE_UNKNOWN) account.type = self.ACCOUNT_TYPES.get(account_type_str, Account.TYPE_UNKNOWN)
account.balance = Decimal(FrenchTransaction.clean_amount(tds[self.CPT_ROW_BALANCE].find("a").text)) account.balance = Decimal(FrenchTransaction.clean_amount(tds[self.CPT_ROW_BALANCE].find("a").text))
account.coming = Decimal(FrenchTransaction.clean_amount( tds[self.CPT_ROW_ENCOURS].find("a").text)) account.coming = Decimal(FrenchTransaction.clean_amount( tds[self.CPT_ROW_ENCOURS].find("a").text))
yield account yield account
return return
class Transaction(FrenchTransaction): class Transaction(FrenchTransaction):
@ -115,17 +115,17 @@ class TransactionsPage(BasePage):
def get_content(td): def get_content(td):
ret = "".join([ttd.text if ttd.text else "" for ttd in td.xpath(".//td")]) ret = "".join([ttd.text if ttd.text else "" for ttd in td.xpath(".//td")])
return ret.replace(u"\xa0", " ").strip() return ret.replace(u"\xa0", " ").strip()
date = get_content(tds[self.TR_DATE]) date = get_content(tds[self.TR_DATE])
raw = get_content(tds[self.TR_TEXT]) raw = get_content(tds[self.TR_TEXT])
debit = get_content(tds[self.TR_DEBIT]) debit = get_content(tds[self.TR_DEBIT])
credit = get_content(tds[self.TR_CREDIT]) credit = get_content(tds[self.TR_CREDIT])
t = Transaction(date+""+raw) t = Transaction(date+""+raw)
t.parse(date, re.sub(r'[ ]+', ' ', raw)) t.parse(date, re.sub(r'[ ]+', ' ', raw))
t.set_amount(credit, debit) t.set_amount(credit, debit)
yield t yield t
class ComingTransactionsPage(BasePage): class ComingTransactionsPage(BasePage):
@ -133,12 +133,12 @@ class ComingTransactionsPage(BasePage):
COM_TR_DATE = 1 COM_TR_DATE = 1
COM_TR_TEXT = 2 COM_TR_TEXT = 2
COM_TR_VALUE = 3 COM_TR_VALUE = 3
def get_history(self): def get_history(self):
comment = None comment = None
for tr in self.document.xpath('//table[@id="operation"]/tbody/tr'): for tr in self.document.xpath('//table[@id="operation"]/tbody/tr'):
tds = tr.findall('td') tds = tr.findall('td')
def get_content(td): def get_content(td):
ret = td.text ret = td.text
return ret.replace(u"\xa0", " ").strip() return ret.replace(u"\xa0", " ").strip()
@ -148,7 +148,7 @@ class ComingTransactionsPage(BasePage):
if comment is None: if comment is None:
comment = get_content(tds[self.COM_TR_COMMENT]) comment = get_content(tds[self.COM_TR_COMMENT])
raw = "%s (%s) " % (raw, comment) raw = "%s (%s) " % (raw, comment)
debit = get_content(tds[self.COM_TR_VALUE]) debit = get_content(tds[self.COM_TR_VALUE])
date = get_content(tds[self.COM_TR_DATE]) date = get_content(tds[self.COM_TR_DATE])
@ -156,12 +156,11 @@ class ComingTransactionsPage(BasePage):
#date is 'JJ/MM'. add '/YYYY' #date is 'JJ/MM'. add '/YYYY'
date += comment[comment.rindex("/"):] date += comment[comment.rindex("/"):]
else: else:
import time
date += "/%d" % time.localtime().tm_year date += "/%d" % time.localtime().tm_year
t = Transaction(date+""+raw) t = Transaction(date+""+raw)
t.parse(date, re.sub(r'[ ]+', ' ', raw)) t.parse(date, re.sub(r'[ ]+', ' ', raw))
t.set_amount("", debit) t.set_amount("", debit)
yield t yield t

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright(C) 2012 Kevin Pouget, based on Romain Bignon # Copyright(C) 2012 Kevin Pouget
# #
# This file is part of weboob. # This file is part of weboob.
# #