login ok, but "AccountNotFound: Account not found" error
This commit is contained in:
parent
38f2f57517
commit
f2b343065f
5 changed files with 126 additions and 103 deletions
|
|
@ -20,4 +20,4 @@
|
||||||
|
|
||||||
from .backend import FortuneoBackend
|
from .backend import FortuneoBackend
|
||||||
|
|
||||||
__all__ = ['SocieteGeneraleBackend']
|
__all__ = ['FortuneoBackend']
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@ class FortuneoBackend(BaseBackend, ICapBank):
|
||||||
VERSION = '0.c'
|
VERSION = '0.c'
|
||||||
LICENSE = 'AGPLv3+'
|
LICENSE = 'AGPLv3+'
|
||||||
DESCRIPTION = u'Fortuneo French bank website'
|
DESCRIPTION = u'Fortuneo French bank website'
|
||||||
CONFIG = BackendConfig(ValueBackendPassword('login', label='Account ID', masked=False),
|
CONFIG = BackendConfig(ValueBackendPassword('login', label='Account ID', masked=False, required=True),
|
||||||
ValueBackendPassword('password', label='Password'))
|
ValueBackendPassword('password', label='Password', required=True))
|
||||||
BROWSER = Fortuneo
|
BROWSER = Fortuneo
|
||||||
|
|
||||||
def create_default_browser(self):
|
def create_default_browser(self):
|
||||||
|
|
@ -51,11 +51,13 @@ class FortuneoBackend(BaseBackend, ICapBank):
|
||||||
yield account
|
yield account
|
||||||
|
|
||||||
def get_account(self, _id):
|
def get_account(self, _id):
|
||||||
#pass
|
# _id = "fortuneo"
|
||||||
#if not _id.isdigit():
|
#print "DEBUG\n\n\n", _id, "DEBUG\n\n\n"
|
||||||
# raise AccountNotFound()
|
if not _id.isdigit():
|
||||||
|
raise AccountNotFound()
|
||||||
with self.browser:
|
with self.browser:
|
||||||
account = self.browser.get_account(_id)
|
account = self.browser.get_account(_id)
|
||||||
|
print "DEBUG 2\n\n\n", account, "\n\n\nEND DEBUG 2"
|
||||||
if account:
|
if account:
|
||||||
return account
|
return account
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -14,19 +14,20 @@
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU Affero General Public License for more details.
|
# GNU Affero General Public License for more details.
|
||||||
#
|
#
|
||||||
|
|
||||||
# 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/>.
|
||||||
|
|
||||||
|
|
||||||
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
|
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
|
||||||
|
|
||||||
from .pages.accounts_list import AccountsList, AccountHistory
|
from .pages.accounts_list import AccountHistory #AccountsList, IndexPage
|
||||||
from .pages.login import LoginPage, BadLoginPage
|
from .pages.login import LoginPage #, BadLoginPage
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['Fortuneo']
|
__all__ = ['Fortuneo']
|
||||||
|
|
||||||
|
# https://www.fortuneo.fr/fr/prive/mes-comptes/livret/consulter-situation/consulter-solde.jsp?COMPTE_ACTIF=FT00991337
|
||||||
class Fortuneo(BaseBrowser):
|
class Fortuneo(BaseBrowser):
|
||||||
DOMAIN_LOGIN = 'www.fortuneo.fr'
|
DOMAIN_LOGIN = 'www.fortuneo.fr'
|
||||||
DOMAIN = 'www.fortuneo.fr'
|
DOMAIN = 'www.fortuneo.fr'
|
||||||
|
|
@ -34,17 +35,20 @@ class Fortuneo(BaseBrowser):
|
||||||
ENCODING = None # refer to the HTML encoding
|
ENCODING = None # refer to the HTML encoding
|
||||||
PAGES = {
|
PAGES = {
|
||||||
'.*identification.jsp.*': LoginPage,
|
'.*identification.jsp.*': LoginPage,
|
||||||
|
#'.*/prive/default.jsp.*': IndexPage,
|
||||||
|
#'.*/prive/default.jsp.*': AccountsList,
|
||||||
|
'.*/prive/default.jsp.*': AccountHistory,
|
||||||
#'https://www.fortuneo.fr/fr/identification.jsp': BadLoginPage,
|
#'https://www.fortuneo.fr/fr/identification.jsp': BadLoginPage,
|
||||||
'.*/prive/default.jsp.*': AccountsList,
|
#'.*/prive/mes-comptes/livret/consulter-situation/consulter-solde\.jsp.*': AccountsList,
|
||||||
'.*/prive/mes-comptes/livret/consulter-situation/consulter-solde.jsp.*': AccountHistory,
|
#'.*/prive/mes-comptes/livret/consulter-situation/consulter-solde\.jsp.*': AccountHistory,
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
BaseBrowser.__init__(self, *args, **kwargs)
|
BaseBrowser.__init__(self, *args, **kwargs)
|
||||||
|
|
||||||
def home(self):
|
def home(self):
|
||||||
self.location('https://' + self.DOMAIN_LOGIN + '/fr/identification.jsp')
|
self.location('/fr/prive/identification.jsp')
|
||||||
#self.location('https://' + self.DOMAIN_LOGIN + '/fr/prive/default.jsp?ANav=1')
|
#self.location('https://' + self.DOMAIN_LOGIN + '/fr/identification.jsp')
|
||||||
#self.location('https://' + self.DOMAIN_LOGIN + '/fr/prive/mes-comptes/synthese-tous-comptes.jsp')
|
#self.location('https://' + self.DOMAIN_LOGIN + '/fr/prive/mes-comptes/synthese-tous-comptes.jsp')
|
||||||
|
|
||||||
def is_logged(self):
|
def is_logged(self):
|
||||||
|
|
@ -60,13 +64,13 @@ class Fortuneo(BaseBrowser):
|
||||||
|
|
||||||
self.page.login(self.username, self.password)
|
self.page.login(self.username, self.password)
|
||||||
|
|
||||||
if self.is_on_page(LoginPage) or \
|
#if self.is_on_page(LoginPage) or \
|
||||||
self.is_on_page(BadLoginPage):
|
# self.is_on_page(BadLoginPage):
|
||||||
raise BrowserIncorrectPassword()
|
# raise BrowserIncorrectPassword()
|
||||||
|
|
||||||
def get_accounts_list(self):
|
def get_accounts_list(self):
|
||||||
if not self.is_on_page(AccountsList):
|
if not self.is_on_page(AccountsList):
|
||||||
self.location('/fr/prive/mes-comptes/synthese-globale/synthese-tous-comptes.jsp')
|
self.location('/fr/prive/default.jsp?ANav=1')
|
||||||
#self.location('')
|
#self.location('')
|
||||||
|
|
||||||
return self.page.get_list()
|
return self.page.get_list()
|
||||||
|
|
@ -74,13 +78,14 @@ class Fortuneo(BaseBrowser):
|
||||||
def get_account(self, id):
|
def get_account(self, id):
|
||||||
assert isinstance(id, basestring)
|
assert isinstance(id, basestring)
|
||||||
|
|
||||||
#if not self.is_on_page(AccountsList):
|
if not self.is_on_page(AccountsList):
|
||||||
# self.location('/fr/prive/default.jsp?ANav=1')
|
self.location('/fr/prive/default.jsp?ANav=1')
|
||||||
|
|
||||||
l = self.page.get_list()
|
print "\n\n\n", self.page, "\n\n\n"
|
||||||
for a in l:
|
#l = self.page.get_list()
|
||||||
if a.id == id:
|
#for a in l:
|
||||||
return a
|
# if a.id == id:
|
||||||
|
# return a
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
# 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/>.
|
||||||
|
|
||||||
|
# AccountsList, IndexPage
|
||||||
from urlparse import parse_qs, urlparse
|
from urlparse import parse_qs, urlparse
|
||||||
from lxml.etree import XML
|
from lxml.etree import XML
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
|
|
@ -29,57 +29,69 @@ from weboob.tools.capabilities.bank.transactions import FrenchTransaction
|
||||||
from weboob.tools.browser import BasePage, BrokenPageError
|
from weboob.tools.browser import BasePage, BrokenPageError
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['AccountsList', 'AccountHistory']
|
#__all__ = ['IndexPage', 'AccountsList', 'AccountHistory']
|
||||||
|
__all__ = ['AccountHistory']
|
||||||
|
|
||||||
|
|
||||||
class AccountsList(BasePage):
|
#class IndexPage(BasePage):
|
||||||
def on_loaded(self):
|
# def on_loaded(self):
|
||||||
pass
|
# pass
|
||||||
|
#
|
||||||
|
# def get_list(self):
|
||||||
|
# l = []
|
||||||
|
# account.label = "test"
|
||||||
|
# account.id = "Livret +"
|
||||||
|
# account.balance = "20"
|
||||||
|
# account._link_id = "https://www.fortuneo.fr/fr/prive/default.jsp?ANav=1"
|
||||||
|
# l.append(account)
|
||||||
|
# return l
|
||||||
|
|
||||||
def get_list(self):
|
#class AccountsList(BasePage):
|
||||||
l = []
|
# def on_loaded(self):
|
||||||
#for el in self.document.xpath('//table[@id="tableauComptesTitEtCotit"]/tbody/'):
|
# pass
|
||||||
#l.append('test')
|
#
|
||||||
#l.append('Livret +')
|
# def get_list(self):
|
||||||
#l.append('20')
|
# #print "DEBUG self.document="+self.document
|
||||||
#l.append('https://www.fortuneo.fr/fr/prive/mes-comptes/livret/caracteristiques-mon-compte/?COMPTE_ACTIF=FT00654224521421145')
|
# account = []
|
||||||
account.label = "test"
|
# account.append('test')
|
||||||
account.id = "Livret +"
|
# account.append('Livret +')
|
||||||
account.balance = "20"
|
# account.append('20')
|
||||||
account._link_id = "https://www.fortuneo.fr/fr/prive/mes-comptes/livret/caracteristiques-mon-compte/?COMPTE_ACTIF=FT00654224521421145"
|
# account.append('https://www.fortuneo.fr/fr/prive/default.jsp?ANav=1')
|
||||||
l.append(account)
|
# return account
|
||||||
#for tr in self.document.getiterator('tr'):
|
# #account.append(account)
|
||||||
# if 'LGNTableRow' in tr.attrib.get('class', '').split():
|
# #for el in self.document.xpath('//table[@id="tableauComptesTitEtCotit"]/tbody/'):
|
||||||
# account = Account()
|
# #l.append(account)
|
||||||
# for td in tr.getiterator('td'):
|
# ##for tr in self.document.getiterator('tr'):
|
||||||
# if td.attrib.get('headers', '') == 'TypeCompte':
|
# ## if 'LGNTableRow' in tr.attrib.get('class', '').split():
|
||||||
# a = td.find('a')
|
# ## account = Account()
|
||||||
# account.label = unicode(a.find("span").text)
|
# ## for td in tr.getiterator('td'):
|
||||||
# account._link_id = a.get('href', '')
|
# ## if td.attrib.get('headers', '') == 'TypeCompte':
|
||||||
|
# ## a = td.find('a')
|
||||||
|
# ## account.label = unicode(a.find("span").text)
|
||||||
|
# ## account._link_id = a.get('href', '')
|
||||||
|
#
|
||||||
|
# ## elif td.attrib.get('headers', '') == 'NumeroCompte':
|
||||||
|
# ## id = td.text
|
||||||
|
# ## id = id.replace(u'\xa0','')
|
||||||
|
# ## account.id = id
|
||||||
|
#
|
||||||
|
# ## elif td.attrib.get('headers', '') == 'Libelle':
|
||||||
|
# ## pass
|
||||||
|
#
|
||||||
|
# ## elif td.attrib.get('headers', '') == 'Solde':
|
||||||
|
# ## balance = td.find('div').text
|
||||||
|
# ## if balance != None:
|
||||||
|
# ## balance = balance.replace(u'\xa0','').replace(',','.')
|
||||||
|
# ## account.balance = Decimal(balance)
|
||||||
|
# ## else:
|
||||||
|
# ## account.balance = Decimal(0)
|
||||||
|
#
|
||||||
|
# ## l.append(account)
|
||||||
|
#
|
||||||
|
# #return l
|
||||||
|
|
||||||
# elif td.attrib.get('headers', '') == 'NumeroCompte':
|
#class Transaction(FrenchTransaction):
|
||||||
# id = td.text
|
# pass
|
||||||
# id = id.replace(u'\xa0','')
|
|
||||||
# account.id = id
|
|
||||||
|
|
||||||
# elif td.attrib.get('headers', '') == 'Libelle':
|
|
||||||
# pass
|
|
||||||
|
|
||||||
# elif td.attrib.get('headers', '') == 'Solde':
|
|
||||||
# balance = td.find('div').text
|
|
||||||
# if balance != None:
|
|
||||||
# balance = balance.replace(u'\xa0','').replace(',','.')
|
|
||||||
# account.balance = Decimal(balance)
|
|
||||||
# else:
|
|
||||||
# account.balance = Decimal(0)
|
|
||||||
|
|
||||||
# l.append(account)
|
|
||||||
|
|
||||||
return l
|
|
||||||
|
|
||||||
class Transaction(FrenchTransaction):
|
|
||||||
print "DEBUG a implementer"
|
|
||||||
pass
|
|
||||||
#PATTERNS = [(re.compile(r'^CARTE \w+ RETRAIT DAB.* (?P<dd>\d{2})/(?P<mm>\d{2}) (?P<HH>\d+)H(?P<MM>\d+) (?P<text>.*)'),
|
#PATTERNS = [(re.compile(r'^CARTE \w+ RETRAIT DAB.* (?P<dd>\d{2})/(?P<mm>\d{2}) (?P<HH>\d+)H(?P<MM>\d+) (?P<text>.*)'),
|
||||||
# FrenchTransaction.TYPE_WITHDRAWAL),
|
# FrenchTransaction.TYPE_WITHDRAWAL),
|
||||||
# (re.compile(r'^(?P<category>CARTE) \w+ (?P<dd>\d{2})/(?P<mm>\d{2}) (?P<text>.*)'),
|
# (re.compile(r'^(?P<category>CARTE) \w+ (?P<dd>\d{2})/(?P<mm>\d{2}) (?P<text>.*)'),
|
||||||
|
|
@ -97,8 +109,9 @@ class Transaction(FrenchTransaction):
|
||||||
# ]
|
# ]
|
||||||
|
|
||||||
class AccountHistory(BasePage):
|
class AccountHistory(BasePage):
|
||||||
|
get_list = [1, 2, 3, 4]
|
||||||
def get_part_url(self):
|
def get_part_url(self):
|
||||||
print "DEBUG a implementer"
|
print "DEBUG AccountHistory.get_part_url a implementer"
|
||||||
pass
|
pass
|
||||||
#for script in self.document.getiterator('script'):
|
#for script in self.document.getiterator('script'):
|
||||||
# if script.text is None:
|
# if script.text is None:
|
||||||
|
|
@ -110,35 +123,35 @@ class AccountHistory(BasePage):
|
||||||
|
|
||||||
#raise BrokenPageError('Unable to find link to history part')
|
#raise BrokenPageError('Unable to find link to history part')
|
||||||
|
|
||||||
def iter_transactions(self):
|
#def iter_transactions(self):
|
||||||
print "DEBUG a implementer"
|
# print "DEBUG iter_transactions a implementer"
|
||||||
pass
|
# pass
|
||||||
#url = self.get_part_url()
|
# #url = self.get_part_url()
|
||||||
#while 1:
|
# #while 1:
|
||||||
# d = XML(self.browser.readurl(url))
|
# # d = XML(self.browser.readurl(url))
|
||||||
# el = d.xpath('//dataBody')[0]
|
# # el = d.xpath('//dataBody')[0]
|
||||||
# s = StringIO(el.text)
|
# # s = StringIO(el.text)
|
||||||
# doc = self.browser.get_document(s)
|
# # doc = self.browser.get_document(s)
|
||||||
|
|
||||||
# for tr in self._iter_transactions(doc):
|
# # for tr in self._iter_transactions(doc):
|
||||||
# yield tr
|
# # yield tr
|
||||||
|
|
||||||
# el = d.xpath('//dataHeader')[0]
|
# # el = d.xpath('//dataHeader')[0]
|
||||||
# if int(el.find('suite').text) != 1:
|
# # if int(el.find('suite').text) != 1:
|
||||||
# return
|
# # return
|
||||||
|
|
||||||
# url = urlparse(url)
|
# # url = urlparse(url)
|
||||||
# p = parse_qs(url.query)
|
# # p = parse_qs(url.query)
|
||||||
# url = self.browser.buildurl(url.path, n10_nrowcolor=0,
|
# # url = self.browser.buildurl(url.path, n10_nrowcolor=0,
|
||||||
# operationNumberPG=el.find('operationNumber').text,
|
# # operationNumberPG=el.find('operationNumber').text,
|
||||||
# operationTypePG=el.find('operationType').text,
|
# # operationTypePG=el.find('operationType').text,
|
||||||
# pageNumberPG=el.find('pageNumber').text,
|
# # pageNumberPG=el.find('pageNumber').text,
|
||||||
# sign=p['sign'][0],
|
# # sign=p['sign'][0],
|
||||||
# src=p['src'][0])
|
# # src=p['src'][0])
|
||||||
|
|
||||||
|
|
||||||
def _iter_transactions(self, doc):
|
def _iter_transactions(self, doc):
|
||||||
print "DEBUG a implementer"
|
print "DEBUG _iter_transactions a implementer"
|
||||||
pass
|
pass
|
||||||
#for i, tr in enumerate(self.parser.select(doc.getroot(), 'tr')):
|
#for i, tr in enumerate(self.parser.select(doc.getroot(), 'tr')):
|
||||||
# t = Transaction(i)
|
# t = Transaction(i)
|
||||||
|
|
|
||||||
|
|
@ -95,5 +95,8 @@ class LoginPage(BasePage):
|
||||||
# self.browser.submit()
|
# self.browser.submit()
|
||||||
|
|
||||||
|
|
||||||
class BadLoginPage(BasePage):
|
#class BadLoginPage(BasePage):
|
||||||
pass
|
|
||||||
|
#print "DEBUG BasePage"
|
||||||
|
# import sys
|
||||||
|
#sys.exit(1)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue