-
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
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 |
|---|---|---|
|
|
@@ -281,6 +281,23 @@ 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 | ||
|
|
||
| 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) | ||
|
|
||
|
|
||
|
|
||
| class GenericPager(Pager): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Mon, 29 Aug 2016 08:07:56 -0700
Frederic Font [email protected] wrote:
True, but it's not going to fail because I do check the boundaries and this is
not called
Salvatore