diff --git a/README.md b/README.md index b18714f..9291981 100644 --- a/README.md +++ b/README.md @@ -271,7 +271,8 @@ advised to use the built-in pager based on cursor paging. ##### Cursor paging -Use `paginate()` for paging results. By default, `paginate`s argument `n_max` +Use `paginate()` for paging results. Each page is a list of records, with a +maximum of `per_page` (default 25). By default, `paginate`s argument `n_max` is set to 10000. Use `None` to retrieve all results. ```python @@ -283,6 +284,19 @@ for page in pager: print(len(page)) ``` +> Looking for an easy method to iterate the records of a pager? + +```python +from itertools import chain +from pyalex import Authors + +query = Authors().search_filter(display_name="einstein") + +for record in chain(*query.paginate(per_page=200)): + print(record["id"]) +``` + + ### Get N-grams OpenAlex reference: [Get N-grams](https://docs.openalex.org/api-entities/works/get-n-grams).