Support pagination for history, fix crash when the call is free
This commit is contained in:
parent
eab0f51e29
commit
5cdefd8966
2 changed files with 13 additions and 3 deletions
|
|
@ -62,7 +62,8 @@ class PoivyBrowser(LoginBrowser):
|
||||||
|
|
||||||
@need_login
|
@need_login
|
||||||
def get_history(self):
|
def get_history(self):
|
||||||
return self.history.stay_or_go().get_calls()
|
self.history.stay_or_go()
|
||||||
|
return self.pagination(lambda: self.page.get_calls())
|
||||||
|
|
||||||
@need_login
|
@need_login
|
||||||
def iter_bills(self, parentid):
|
def iter_bills(self, parentid):
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
# 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.browser2.page import HTMLPage, LoggedPage, method, ListElement, ItemElement
|
from weboob.tools.browser2.page import HTMLPage, LoggedPage, method, ListElement, ItemElement
|
||||||
from weboob.tools.browser2.filters import Env, CleanText, CleanDecimal, Field, Attr, Filter, Time, Date
|
from weboob.tools.browser2.filters import Env, CleanText, CleanDecimal, Field, Attr, Filter, Time, Date, Link
|
||||||
from weboob.capabilities.bill import Subscription, Detail
|
from weboob.capabilities.bill import Subscription, Detail
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
@ -87,11 +87,20 @@ class HistoryPage(LoggedPage, HTMLPage):
|
||||||
class get_calls(ListElement):
|
class get_calls(ListElement):
|
||||||
item_xpath = '//table/tbody/tr'
|
item_xpath = '//table/tbody/tr'
|
||||||
|
|
||||||
|
def next_page(self):
|
||||||
|
link_path = "//div[@class='date-navigator center']/span/a"
|
||||||
|
text = CleanText(link_path)(self.page.doc)
|
||||||
|
if "Previous" in text:
|
||||||
|
link = Link(link_path)(self.page.doc)
|
||||||
|
return link
|
||||||
|
return
|
||||||
|
|
||||||
class item(ItemElement):
|
class item(ItemElement):
|
||||||
klass = Detail
|
klass = Detail
|
||||||
|
|
||||||
|
obj_id = None
|
||||||
obj_datetime = Env('datetime')
|
obj_datetime = Env('datetime')
|
||||||
obj_price = CleanDecimal('td[7]', replace_dots=False)
|
obj_price = CleanDecimal('td[7]', replace_dots=False, default=0)
|
||||||
obj_currency = u'EUR'
|
obj_currency = u'EUR'
|
||||||
obj_label = Env('label')
|
obj_label = Env('label')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue