-
Notifications
You must be signed in to change notification settings - Fork 38
Retrieve a specific n page #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,7 @@ | |
|
|
||
| try: # python 3 | ||
| from urllib.request import urlopen, FancyUrlOpener, Request # noqa | ||
| from urllib.parse import urlencode, quote | ||
| from urllib.parse import urlparse, urlencode, quote | ||
| from urllib.error import HTTPError | ||
| except ImportError: # python 2.7 | ||
| from urllib import urlencode, FancyURLopener, quote | ||
|
|
@@ -281,6 +281,26 @@ def previous_page(self): | |
| Get a Pager with the previous results page. | ||
| """ | ||
| return FSRequest.request(self.previous, {}, self.client, Pager) | ||
| def get_page(self, n): | ||
| url = self.next | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will fail if self.next is None (which could happen if there are no other pages)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On 2016年8月29日 08:07:56 -0700
True, but it's not going to fail because I do check the boundaries and this is Salvatore |
||
|
|
||
| if (url): | ||
| uri = urlparse(url) | ||
| for index,item in enumerate(uri): | ||
| if ('query' in item): | ||
| urid=index | ||
|
|
||
| query = uri[urid].split("&") | ||
|
|
||
| for index,item in enumerate(query): | ||
| if ("page" in item): | ||
| query[index] = 'page=' + str(n) | ||
|
|
||
| url = uri[0] + '://' + uri[1] + uri[2] + '?' + "&".join(query) | ||
| return FSRequest.request(url, {}, self.client, Pager) | ||
| else: | ||
| return None | ||
|
|
||
|
|
||
|
|
||
| class GenericPager(Pager): | ||
|
|
||