Skip to content
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

Update api.py with docstring for paginate #18

Merged
merged 2 commits into from
May 20, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion pyalex/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,22 @@ def get(self, return_meta=False, page=None, per_page=None, cursor=None):
return results

def paginate(self, per_page=None, cursor="*", n_max=10000):

"""Used for paging results of large responses using cursor paging.

OpenAlex offers two methods for paging: basic paging and cursor paging.
Both methods are supported by PyAlex, although cursor paging seems to be
easier to implement and less error-prone.

Args:
per_page (_type_, optional): Entries per page to return. Defaults to None.
cursor (str, optional): _description_. Defaults to "*".
n_max (int, optional): Number of max results (not pages) to return.
Defaults to 10000.

Returns:
CursorPaginator: Itterator to use for returning and processing each page
J535D165 marked this conversation as resolved.
Show resolved Hide resolved
result in sequence.
"""
return CursorPaginator(self, per_page=per_page, cursor=cursor, n_max=n_max)

def random(self):
Expand Down