mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-22 21:53:32 +00:00
55 lines
1.8 KiB
Diff
55 lines
1.8 KiB
Diff
--- a/woob/browser/browsers.py
|
|
+++ b/woob/browser/browsers.py
|
|
@@ -930,23 +930,6 @@
|
|
|
|
:class:`NextPage` constructor can take an url or a Request object.
|
|
|
|
- >>> from .pages import HTMLPage
|
|
- >>> class Page(HTMLPage):
|
|
- ... def iter_values(self):
|
|
- ... for el in self.doc.xpath('//li'):
|
|
- ... yield el.text
|
|
- ... for next in self.doc.xpath('//a'):
|
|
- ... raise NextPage(next.attrib['href'])
|
|
- ...
|
|
- >>> class Browser(PagesBrowser):
|
|
- ... BASEURL = 'https://woob.tech'
|
|
- ... list = URL('/tests/list-(?P<pagenum>\d+).html', Page)
|
|
- ...
|
|
- >>> b = Browser()
|
|
- >>> b.list.go(pagenum=1) # doctest: +ELLIPSIS
|
|
- <woob.browser.browsers.Page object at 0x...>
|
|
- >>> list(b.pagination(lambda: b.page.iter_values()))
|
|
- ['One', 'Two', 'Three', 'Four']
|
|
"""
|
|
while True:
|
|
try:
|
|
--- a/woob/browser/pages.py
|
|
+++ b/woob/browser/pages.py
|
|
@@ -49,25 +49,6 @@
|
|
|
|
:class:`NextPage` constructor can take an url or a Request object.
|
|
|
|
- >>> class Page(HTMLPage):
|
|
- ... @pagination
|
|
- ... def iter_values(self):
|
|
- ... for el in self.doc.xpath('//li'):
|
|
- ... yield el.text
|
|
- ... for next in self.doc.xpath('//a'):
|
|
- ... raise NextPage(next.attrib['href'])
|
|
- ...
|
|
- >>> from .browsers import PagesBrowser
|
|
- >>> from .url import URL
|
|
- >>> class Browser(PagesBrowser):
|
|
- ... BASEURL = 'https://woob.tech'
|
|
- ... list = URL('/tests/list-(?P<pagenum>\d+).html', Page)
|
|
- ...
|
|
- >>> b = Browser()
|
|
- >>> b.list.go(pagenum=1) # doctest: +ELLIPSIS
|
|
- <woob.browser.pages.Page object at 0x...>
|
|
- >>> list(b.page.iter_values())
|
|
- ['One', 'Two', 'Three', 'Four']
|
|
"""
|
|
|
|
@wraps(func)
|