Skip to content

Commit

Permalink
Add docstring to paginate method (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
zlatko-minev authored May 20, 2023
1 parent 2d02c6a commit 8a2c2ff
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion pyalex/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,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: Iterator to use for returning and processing each page
result in sequence.
"""
return CursorPaginator(self, per_page=per_page, cursor=cursor, n_max=n_max)

def random(self):
Expand Down

0 comments on commit 8a2c2ff

Please sign in to comment.