fixes on fortuneo module
backend.py
iter_history() implemented
browser.py
'.*/prive/default\.jsp.*' page added to AccountsList to prevent warnings
full url on self.location() using 'https://' + self.DOMAIN_LOGIN + 'stuff'
pages/accounts_list.py
added unicode() to prevent warnings
test.py
test really implemented after site maintenance
This commit is contained in:
parent
3672c2e752
commit
507c9d2c80
4 changed files with 13 additions and 13 deletions
|
|
@ -73,10 +73,6 @@ class FortuneoBackend(BaseBackend, ICapBank):
|
||||||
else:
|
else:
|
||||||
raise AccountNotFound()
|
raise AccountNotFound()
|
||||||
|
|
||||||
def iter_coming(self, account):
|
|
||||||
"""Iter coming transactions on a specific account Not supported yet"""
|
|
||||||
raise NotImplementedError()
|
|
||||||
|
|
||||||
def iter_history(self, account):
|
def iter_history(self, account):
|
||||||
"""Iter history of transactions on a specific account"""
|
"""Iter history of transactions on a specific account"""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
from weboob.tools.browser import BaseBrowser #, BrowserIncorrectPassword
|
from weboob.tools.browser import BaseBrowser
|
||||||
|
|
||||||
from .pages.login import LoginPage
|
from .pages.login import LoginPage
|
||||||
from .pages.accounts_list import AccountsList, AccountHistoryPage
|
from .pages.accounts_list import AccountsList, AccountHistoryPage
|
||||||
|
|
@ -37,7 +37,9 @@ class Fortuneo(BaseBrowser):
|
||||||
'.*/prive/mes-comptes/synthese-tous-comptes\.jsp.*':
|
'.*/prive/mes-comptes/synthese-tous-comptes\.jsp.*':
|
||||||
AccountsList,
|
AccountsList,
|
||||||
'.*/prive/mes-comptes/livret/consulter-situation/consulter-solde\.jsp\?COMPTE_ACTIF=.*':
|
'.*/prive/mes-comptes/livret/consulter-situation/consulter-solde\.jsp\?COMPTE_ACTIF=.*':
|
||||||
AccountHistoryPage
|
AccountHistoryPage,
|
||||||
|
'.*/prive/default\.jsp.*':
|
||||||
|
AccountsList
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
|
@ -45,7 +47,8 @@ class Fortuneo(BaseBrowser):
|
||||||
|
|
||||||
def home(self):
|
def home(self):
|
||||||
"""main page (login)"""
|
"""main page (login)"""
|
||||||
self.location('/fr/prive/identification.jsp')
|
|
||||||
|
self.location('https://' + self.DOMAIN_LOGIN + '/fr/prive/identification.jsp')
|
||||||
|
|
||||||
def is_logged(self):
|
def is_logged(self):
|
||||||
"""Return True if we are logged on website"""
|
"""Return True if we are logged on website"""
|
||||||
|
|
@ -67,7 +70,7 @@ class Fortuneo(BaseBrowser):
|
||||||
self.location('https://' + self.DOMAIN_LOGIN + '/fr/identification.jsp')
|
self.location('https://' + self.DOMAIN_LOGIN + '/fr/identification.jsp')
|
||||||
|
|
||||||
self.page.login(self.username, self.password)
|
self.page.login(self.username, self.password)
|
||||||
self.location('/fr/prive/mes-comptes/synthese-tous-comptes.jsp')
|
self.location('https://' + self.DOMAIN_LOGIN + '/fr/prive/mes-comptes/synthese-tous-comptes.jsp')
|
||||||
|
|
||||||
def get_history(self, account):
|
def get_history(self, account):
|
||||||
if not self.is_on_page(AccountHistoryPage):
|
if not self.is_on_page(AccountHistoryPage):
|
||||||
|
|
@ -78,12 +81,13 @@ class Fortuneo(BaseBrowser):
|
||||||
"""accounts list"""
|
"""accounts list"""
|
||||||
|
|
||||||
if not self.is_on_page(AccountsList):
|
if not self.is_on_page(AccountsList):
|
||||||
self.location('/fr/prive/mes-comptes/synthese-tous-comptes.jsp')
|
self.location('https://' + self.DOMAIN_LOGIN + '/fr/prive/mes-comptes/synthese-tous-comptes.jsp')
|
||||||
|
|
||||||
return self.page.get_list()
|
return self.page.get_list()
|
||||||
|
|
||||||
def get_account(self, id):
|
def get_account(self, id):
|
||||||
"""Get an account from its ID"""
|
"""Get an account from its ID"""
|
||||||
|
|
||||||
assert isinstance(id, basestring)
|
assert isinstance(id, basestring)
|
||||||
l = self.get_accounts_list()
|
l = self.get_accounts_list()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ from weboob.capabilities import NotAvailable
|
||||||
|
|
||||||
__all__ = ['AccountsList', 'AccountHistoryPage']
|
__all__ = ['AccountsList', 'AccountHistoryPage']
|
||||||
|
|
||||||
|
|
||||||
class AccountHistoryPage(BasePage):
|
class AccountHistoryPage(BasePage):
|
||||||
def get_operations(self, _id):
|
def get_operations(self, _id):
|
||||||
"""history, see http://docs.weboob.org/api/capabilities/bank.html?highlight=transaction#weboob.capabilities.bank.Transaction"""
|
"""history, see http://docs.weboob.org/api/capabilities/bank.html?highlight=transaction#weboob.capabilities.bank.Transaction"""
|
||||||
|
|
@ -47,7 +46,7 @@ class AccountHistoryPage(BasePage):
|
||||||
date_oper = tables[i].xpath("./td[2]/text()")[0]
|
date_oper = tables[i].xpath("./td[2]/text()")[0]
|
||||||
date_val = tables[i].xpath("./td[3]/text()")[0]
|
date_val = tables[i].xpath("./td[3]/text()")[0]
|
||||||
label = tables[i].xpath("./td[4]/text()")[0]
|
label = tables[i].xpath("./td[4]/text()")[0]
|
||||||
operation.label = operation.raw = label.strip()
|
operation.label = unicode(label.strip())
|
||||||
amount = tables[i].xpath("./td[5]/text() | ./td[6]/text()")
|
amount = tables[i].xpath("./td[5]/text() | ./td[6]/text()")
|
||||||
operation.date = datetime.datetime.strptime(date_val, "%d/%m/%Y")
|
operation.date = datetime.datetime.strptime(date_val, "%d/%m/%Y")
|
||||||
operation.rdate = datetime.datetime.strptime(date_oper,"%d/%m/%Y")
|
operation.rdate = datetime.datetime.strptime(date_oper,"%d/%m/%Y")
|
||||||
|
|
@ -95,7 +94,7 @@ class AccountsList(BasePage):
|
||||||
|
|
||||||
# account.label
|
# account.label
|
||||||
tpl = cpt.xpath("./td[2]/a/text()")[0].split(' ')
|
tpl = cpt.xpath("./td[2]/a/text()")[0].split(' ')
|
||||||
account.label = ' '.join(tpl[:2])
|
account.label = unicode(' '.join(tpl[:2]))
|
||||||
|
|
||||||
l.append(account)
|
l.append(account)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,5 +27,6 @@ class FortuneoTest(BackendTest):
|
||||||
l = list(self.backend.iter_accounts())
|
l = list(self.backend.iter_accounts())
|
||||||
self.assertTrue(len(l) > 0)
|
self.assertTrue(len(l) > 0)
|
||||||
a = l[0]
|
a = l[0]
|
||||||
list(self.backend.iter_coming(a))
|
|
||||||
list(self.backend.iter_history(a))
|
list(self.backend.iter_history(a))
|
||||||
|
|
||||||
|
# vim:ts=4:sw=4
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue