diff --git a/docs/source/guides/cookbook.rst b/docs/source/guides/cookbook.rst index 85d2cf2bbaa9d3023afd0bfa3f5e45b281a170d1..13f96176c1cb7504749a89314beae368e981c330 100644 --- a/docs/source/guides/cookbook.rst +++ b/docs/source/guides/cookbook.rst @@ -207,11 +207,11 @@ This example code isn't very semantic and could fail silently if columns are cha obj_id = CleanText('./td[1]') obj_foo = CleanText('./td[2]') -It can be improved by using the column labels:: +It can be improved by using a :class:`weboob.browser.elements.TableElement` and the column labels:: class MyPage(HTMLPage): @method - class iter_stuff(ListElement): + class iter_stuff(TableElement): head_xpath = '//table/tr/th' # where to look for column titles # these are the column titles from the site @@ -275,8 +275,8 @@ When going to next page requires making a ``POST``:: @method class iter_stuff(ListElement): def next_page(self): - if self.doc.get('next_page_params'): - return requests.Request('POST', self.page.url, data=self.doc.get('next_page_params')) + if self.page.doc.get('next_page_params'): + return requests.Request('POST', self.page.url, data=self.page.doc.get('next_page_params')) item_xpath = 'items' diff --git a/docs/source/guides/module.rst b/docs/source/guides/module.rst index 2de832a5c87e91b435f2c638b534e69bb93fb07d..9ab5d86ea4b089e899819d36a067146f40404c5f 100644 --- a/docs/source/guides/module.rst +++ b/docs/source/guides/module.rst @@ -391,6 +391,7 @@ decorated method. You can either define it yourself, as a class boolean attribute or as a property, or inherit your class from :class:`LoggedPage `. In the latter case, remember that Python inheritance requires the :class:`LoggedPage ` to be placed first such as in:: + from weboob.browser.pages import LoggedPage, HTMLPage class OnlyForLoggedUserPage(LoggedPage, HTMLPage):