From 8a2c2ff7c3e8a5086df11ad7a8329706b55f9178 Mon Sep 17 00:00:00 2001 From: Zlatko Minev Date: Sat, 20 May 2023 08:07:22 -0400 Subject: [PATCH] Add docstring to paginate method (#18) --- pyalex/api.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pyalex/api.py b/pyalex/api.py index bdbf5f8..03c231d 100644 --- a/pyalex/api.py +++ b/pyalex/api.py @@ -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):