correctly handle expired sessions

This commit is contained in:
Romain Bignon 2015-05-07 13:36:23 +02:00
commit 794e506432

View file

@ -20,7 +20,7 @@
import datetime
from weboob.browser.pages import HTMLPage, LoggedPage, pagination
from weboob.browser.pages import HTMLPage, pagination
from weboob.browser.elements import ListElement, ItemElement, method
from weboob.browser.filters.standard import CleanText, CleanDecimal, Regexp, DateGuesser, Env
from weboob.browser.filters.html import Link
@ -41,11 +41,19 @@ class LoginPage(HTMLPage):
form.submit()
class CMSOPage(HTMLPage):
@property
def logged(self):
if len(self.doc.xpath('//b[text()="Session interrompue"]')) > 0:
return False
return True
class CmsoListElement(ListElement):
item_xpath = '//table[@class="Tb" and tr[1][@class="LnTit"]]/tr[@class="LnA" or @class="LnB"]'
class AccountsPage(LoggedPage, HTMLPage):
class AccountsPage(CMSOPage):
@method
class iter_accounts(CmsoListElement):
class item(ItemElement):
@ -69,7 +77,7 @@ class CmsoTransactionElement(ItemElement):
return len(self.el) >= 5 and not self.el.get('id', '').startswith('libelleLong')
class HistoryPage(LoggedPage, HTMLPage):
class HistoryPage(CMSOPage):
def iter_history(self, *args, **kwargs):
if self.doc.xpath('//a[@href="1-situationGlobaleProfessionnel.act"]'):
return self.iter_history_rest_page(*args, **kwargs)