Delubac: history: support pagination
This commit is contained in:
parent
d3f9ce1fe2
commit
3f4a0b85fd
2 changed files with 17 additions and 3 deletions
|
|
@ -38,7 +38,7 @@ class DelubacBrowser(BaseBrowser):
|
|||
PAGES = {
|
||||
'%s://%s/(simpleIndex|index).do(\;.*)?' % (PROTOCOL, DOMAIN): LoginPage,
|
||||
'%s://%s/tbord.do(\?.*)?' % (PROTOCOL, DOMAIN): DashboardPage,
|
||||
'%s://%s/releve.do' % (PROTOCOL, DOMAIN): OperationsPage,
|
||||
'%s://%s/releve.do(\?.*)?' % (PROTOCOL, DOMAIN): OperationsPage,
|
||||
}
|
||||
|
||||
PAGES_REV = {
|
||||
|
|
@ -79,6 +79,14 @@ class DelubacBrowser(BaseBrowser):
|
|||
|
||||
def iter_history(self, account):
|
||||
self.location(account._url)
|
||||
assert self.is_on_page(OperationsPage)
|
||||
|
||||
return self.page.iter_history()
|
||||
while True:
|
||||
assert self.is_on_page(OperationsPage)
|
||||
for i in self.page.iter_history():
|
||||
yield i
|
||||
|
||||
next_page = self.page.next_page()
|
||||
if not next_page:
|
||||
break
|
||||
|
||||
self.location(next_page)
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ class DashboardPage(BasePage):
|
|||
|
||||
class OperationsPage(BasePage):
|
||||
_LINE_XPATH = '//tr[starts-with(@class,"PL_LIGLST_")]'
|
||||
_NEXT_XPATH = '//a[contains(@class,"pg_next")]/@href'
|
||||
|
||||
def iter_history(self):
|
||||
i = 0
|
||||
|
|
@ -92,6 +93,11 @@ class OperationsPage(BasePage):
|
|||
|
||||
yield operation
|
||||
|
||||
def next_page(self):
|
||||
next_button = self.document.xpath(self._NEXT_XPATH)
|
||||
if next_button:
|
||||
return next_button[0]
|
||||
|
||||
|
||||
class Transaction(FrenchTransaction):
|
||||
PATTERNS = [(re.compile('^(?:Vir(?:ement)?|VRT) (?P<text>.*)', re.I),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue