cleanup and update AUTHORS
This commit is contained in:
parent
4ea0883794
commit
dfbcda1cac
5 changed files with 41 additions and 44 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright(C) 2012 Kevin Pouget, based on Romain Bignon work
|
||||
# Copyright(C) 2012 Kevin Pouget
|
||||
#
|
||||
# This file is part of weboob.
|
||||
#
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from urlparse import urlsplit, parse_qsl
|
||||
from decimal import Decimal
|
||||
import re
|
||||
import time
|
||||
|
||||
from weboob.tools.browser import BasePage
|
||||
from weboob.capabilities.bank import Account
|
||||
|
|
@ -33,7 +33,7 @@ class LoginPage(BasePage):
|
|||
def login(self, login, pin, strong_auth):
|
||||
form_nb = 1 if strong_auth else 0
|
||||
indentType = "RENFORCE" if strong_auth else "MDP"
|
||||
|
||||
|
||||
self.browser.select_form(name='loginCoForm', nr=form_nb)
|
||||
self.browser['codeUtil'] = login
|
||||
self.browser['motPasse'] = pin
|
||||
|
|
@ -43,13 +43,13 @@ class LoginPage(BasePage):
|
|||
|
||||
class AccountsPage(BasePage):
|
||||
ACCOUNT_TYPES = {u'COMPTE NEF': Account.TYPE_CHECKING}
|
||||
|
||||
|
||||
CPT_ROW_ID = 0
|
||||
CPT_ROW_NAME = 1
|
||||
CPT_ROW_NATURE = 2
|
||||
CPT_ROW_BALANCE = 3
|
||||
CPT_ROW_ENCOURS = 4
|
||||
|
||||
|
||||
def is_error(self):
|
||||
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:
|
||||
|
|
@ -60,20 +60,20 @@ class AccountsPage(BasePage):
|
|||
def get_list(self):
|
||||
for trCompte in self.document.xpath('//table[@id="compte"]/tbody/tr'):
|
||||
tds = trCompte.findall('td')
|
||||
|
||||
|
||||
account = Account()
|
||||
|
||||
|
||||
account.id = tds[self.CPT_ROW_ID].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 = 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.coming = Decimal(FrenchTransaction.clean_amount( tds[self.CPT_ROW_ENCOURS].find("a").text))
|
||||
yield account
|
||||
|
||||
|
||||
return
|
||||
|
||||
class Transaction(FrenchTransaction):
|
||||
|
|
@ -115,17 +115,17 @@ class TransactionsPage(BasePage):
|
|||
def get_content(td):
|
||||
ret = "".join([ttd.text if ttd.text else "" for ttd in td.xpath(".//td")])
|
||||
return ret.replace(u"\xa0", " ").strip()
|
||||
|
||||
|
||||
date = get_content(tds[self.TR_DATE])
|
||||
raw = get_content(tds[self.TR_TEXT])
|
||||
|
||||
|
||||
debit = get_content(tds[self.TR_DEBIT])
|
||||
credit = get_content(tds[self.TR_CREDIT])
|
||||
|
||||
t = Transaction(date+""+raw)
|
||||
t.parse(date, re.sub(r'[ ]+', ' ', raw))
|
||||
t.set_amount(credit, debit)
|
||||
|
||||
|
||||
yield t
|
||||
|
||||
class ComingTransactionsPage(BasePage):
|
||||
|
|
@ -133,12 +133,12 @@ class ComingTransactionsPage(BasePage):
|
|||
COM_TR_DATE = 1
|
||||
COM_TR_TEXT = 2
|
||||
COM_TR_VALUE = 3
|
||||
|
||||
|
||||
def get_history(self):
|
||||
comment = None
|
||||
for tr in self.document.xpath('//table[@id="operation"]/tbody/tr'):
|
||||
tds = tr.findall('td')
|
||||
|
||||
|
||||
def get_content(td):
|
||||
ret = td.text
|
||||
return ret.replace(u"\xa0", " ").strip()
|
||||
|
|
@ -148,7 +148,7 @@ class ComingTransactionsPage(BasePage):
|
|||
if comment is None:
|
||||
comment = get_content(tds[self.COM_TR_COMMENT])
|
||||
raw = "%s (%s) " % (raw, comment)
|
||||
|
||||
|
||||
debit = get_content(tds[self.COM_TR_VALUE])
|
||||
date = get_content(tds[self.COM_TR_DATE])
|
||||
|
||||
|
|
@ -156,12 +156,11 @@ class ComingTransactionsPage(BasePage):
|
|||
#date is 'JJ/MM'. add '/YYYY'
|
||||
date += comment[comment.rindex("/"):]
|
||||
else:
|
||||
import time
|
||||
date += "/%d" % time.localtime().tm_year
|
||||
|
||||
|
||||
|
||||
t = Transaction(date+""+raw)
|
||||
t.parse(date, re.sub(r'[ ]+', ' ', raw))
|
||||
t.set_amount("", debit)
|
||||
|
||||
|
||||
yield t
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue