summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRoger Meier <r.meier@siemens.com>2020-01-26 17:49:22 +0100
committerGitHub <noreply@github.com>2020-01-26 17:49:22 +0100
commitdf485a92b713a0f2f983c72d9d41ea3a771abf88 (patch)
tree70a2f9eb46f50fd59a55118708d1e34d660333b7 /docs
parent7fd3226fc6b629d503bc1b0a657bc21f69bc4696 (diff)
parentd1879253dae93e182710fe22b0a6452296e2b532 (diff)
downloadgitlab-df485a92b713a0f2f983c72d9d41ea3a771abf88.tar.gz
Merge pull request #1001 from python-gitlab/feat/keyset-paginationv2.0.0
Feat/keyset pagination
Diffstat (limited to 'docs')
-rw-r--r--docs/api-usage.rst12
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/api-usage.rst b/docs/api-usage.rst
index d211e25..19fdea0 100644
--- a/docs/api-usage.rst
+++ b/docs/api-usage.rst
@@ -219,6 +219,18 @@ You can define the ``per_page`` value globally to avoid passing it to every
gl = gitlab.Gitlab(url, token, per_page=50)
+Gitlab allows to also use keyset pagination. You can supply it to your project listing,
+but you can also do so globally. Be aware that GitLab then also requires you to only use supported
+order options. At the time of writing, only ``order_by="id"`` works.
+
+.. code-block:: python
+
+ gl = gitlab.Gitlab(url, token, pagination="keyset", order_by="id", per_page=100)
+ gl.projects.list()
+
+Reference:
+https://docs.gitlab.com/ce/api/README.html#keyset-based-pagination
+
``list()`` methods can also return a generator object which will handle the
next calls to the API when required. This is the recommended way to iterate
through a large number of items: