login ok, but "AccountNotFound: Account not found" error

This commit is contained in:
sputnick 2012-04-17 01:17:35 +02:00 committed by Romain Bignon
commit f2b343065f
5 changed files with 126 additions and 103 deletions

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
# AccountsList, IndexPage
from urlparse import parse_qs, urlparse
from lxml.etree import XML
from cStringIO import StringIO
@ -29,57 +29,69 @@ from weboob.tools.capabilities.bank.transactions import FrenchTransaction
from weboob.tools.browser import BasePage, BrokenPageError
__all__ = ['AccountsList', 'AccountHistory']
#__all__ = ['IndexPage', 'AccountsList', 'AccountHistory']
__all__ = ['AccountHistory']
class AccountsList(BasePage):
def on_loaded(self):
pass
#class IndexPage(BasePage):
# def on_loaded(self):
# 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):
l = []
#for el in self.document.xpath('//table[@id="tableauComptesTitEtCotit"]/tbody/'):
#l.append('test')
#l.append('Livret +')
#l.append('20')
#l.append('https://www.fortuneo.fr/fr/prive/mes-comptes/livret/caracteristiques-mon-compte/?COMPTE_ACTIF=FT00654224521421145')
account.label = "test"
account.id = "Livret +"
account.balance = "20"
account._link_id = "https://www.fortuneo.fr/fr/prive/mes-comptes/livret/caracteristiques-mon-compte/?COMPTE_ACTIF=FT00654224521421145"
l.append(account)
#for tr in self.document.getiterator('tr'):
# if 'LGNTableRow' in tr.attrib.get('class', '').split():
# account = Account()
# for td in tr.getiterator('td'):
# if td.attrib.get('headers', '') == 'TypeCompte':
# a = td.find('a')
# account.label = unicode(a.find("span").text)
# account._link_id = a.get('href', '')
#class AccountsList(BasePage):
# def on_loaded(self):
# pass
#
# def get_list(self):
# #print "DEBUG self.document="+self.document
# account = []
# account.append('test')
# account.append('Livret +')
# account.append('20')
# account.append('https://www.fortuneo.fr/fr/prive/default.jsp?ANav=1')
# return account
# #account.append(account)
# #for el in self.document.xpath('//table[@id="tableauComptesTitEtCotit"]/tbody/'):
# #l.append(account)
# ##for tr in self.document.getiterator('tr'):
# ## if 'LGNTableRow' in tr.attrib.get('class', '').split():
# ## account = Account()
# ## for td in tr.getiterator('td'):
# ## 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':
# 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
class Transaction(FrenchTransaction):
print "DEBUG a implementer"
pass
#class Transaction(FrenchTransaction):
# 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>.*)'),
# FrenchTransaction.TYPE_WITHDRAWAL),
# (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):
get_list = [1, 2, 3, 4]
def get_part_url(self):
print "DEBUG a implementer"
print "DEBUG AccountHistory.get_part_url a implementer"
pass
#for script in self.document.getiterator('script'):
# if script.text is None:
@ -110,35 +123,35 @@ class AccountHistory(BasePage):
#raise BrokenPageError('Unable to find link to history part')
def iter_transactions(self):
print "DEBUG a implementer"
pass
#url = self.get_part_url()
#while 1:
# d = XML(self.browser.readurl(url))
# el = d.xpath('//dataBody')[0]
# s = StringIO(el.text)
# doc = self.browser.get_document(s)
#def iter_transactions(self):
# print "DEBUG iter_transactions a implementer"
# pass
# #url = self.get_part_url()
# #while 1:
# # d = XML(self.browser.readurl(url))
# # el = d.xpath('//dataBody')[0]
# # s = StringIO(el.text)
# # doc = self.browser.get_document(s)
# for tr in self._iter_transactions(doc):
# yield tr
# # for tr in self._iter_transactions(doc):
# # yield tr
# el = d.xpath('//dataHeader')[0]
# if int(el.find('suite').text) != 1:
# return
# # el = d.xpath('//dataHeader')[0]
# # if int(el.find('suite').text) != 1:
# # return
# url = urlparse(url)
# p = parse_qs(url.query)
# url = self.browser.buildurl(url.path, n10_nrowcolor=0,
# operationNumberPG=el.find('operationNumber').text,
# operationTypePG=el.find('operationType').text,
# pageNumberPG=el.find('pageNumber').text,
# sign=p['sign'][0],
# src=p['src'][0])
# # url = urlparse(url)
# # p = parse_qs(url.query)
# # url = self.browser.buildurl(url.path, n10_nrowcolor=0,
# # operationNumberPG=el.find('operationNumber').text,
# # operationTypePG=el.find('operationType').text,
# # pageNumberPG=el.find('pageNumber').text,
# # sign=p['sign'][0],
# # src=p['src'][0])
def _iter_transactions(self, doc):
print "DEBUG a implementer"
print "DEBUG _iter_transactions a implementer"
pass
#for i, tr in enumerate(self.parser.select(doc.getroot(), 'tr')):
# t = Transaction(i)

View file

@ -95,5 +95,8 @@ class LoginPage(BasePage):
# self.browser.submit()
class BadLoginPage(BasePage):
pass
#class BadLoginPage(BasePage):
#print "DEBUG BasePage"
# import sys
#sys.exit(1)