fix accounts list on new version of website

This commit is contained in:
Romain Bignon 2013-03-12 14:32:26 +01:00
commit eeed606757
2 changed files with 28 additions and 2 deletions

View file

@ -79,8 +79,7 @@ class Fortuneo(BaseBrowser):
self.location('/ReloadContext?action=1&')
def get_history(self, account):
if not self.is_on_page(AccountHistoryPage):
self.location(account._link_id)
self.location(account._link_id)
return self.page.get_operations(account)
def get_accounts_list(self):

View file

@ -17,6 +17,8 @@
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from lxml.html import etree
from decimal import Decimal
import re
import datetime
@ -25,6 +27,7 @@ from weboob.capabilities.bank import Account
from weboob.tools.browser import BasePage, BrowserIncorrectPassword
from weboob.capabilities import NotAvailable
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
from weboob.tools.json import json
__all__ = ['GlobalAccountsList', 'AccountsList', 'AccountHistoryPage']
@ -90,6 +93,30 @@ class AccountsList(BasePage):
if len(warn) > 0:
raise BrowserIncorrectPassword(warn[0].text)
# load content of loading divs.
divs = []
for div in self.document.xpath('//div[starts-with(@id, "as_")]'):
loading = div.xpath('.//span[@class="loading"]')
if len(loading) == 0:
continue
input = div.xpath('.//input')[0]
divs.append([div, input.attrib['name']])
if len(divs) > 0:
args = {}
for i, (div, name) in enumerate(divs):
args['key%s' % i] = name
args['div%s' % i] = div.attrib['id']
args['time'] = 0
r = self.browser.openurl(self.browser.buildurl('/AsynchAjax', **args))
data = json.load(r)
for i, (div, name) in enumerate(divs):
html = data['data'][i]['flux']
div.clear()
div.insert(0, etree.fromstring(html, parser=etree.HTMLParser()))
def need_reload(self):
form = self.document.xpath('//form[@name="InformationsPersonnellesForm"]')
return len(form) > 0