summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2018-05-26 08:21:45 +0200
committerGauvain Pocentek <gauvain@pocentek.net>2018-05-26 08:21:45 +0200
commit660f0cf546d18b28883e97c1182984593bbae643 (patch)
treed2ef09b1cd4ef987bbb2984fb528c8b7b1ee0b5c
parentd9819042acde6cb30cbac3ef8f4fefa15a282459 (diff)
downloadgitlab-660f0cf546d18b28883e97c1182984593bbae643.tar.gz
Document the global per_page setting
-rw-r--r--docs/api-usage.rst7
-rw-r--r--docs/cli.rst4
2 files changed, 11 insertions, 0 deletions
diff --git a/docs/api-usage.rst b/docs/api-usage.rst
index 0882b21..4c57c29 100644
--- a/docs/api-usage.rst
+++ b/docs/api-usage.rst
@@ -189,6 +189,13 @@ parameter to get all the items when using listing methods:
all_groups = gl.groups.list(all=True)
all_owned_projects = gl.projects.owned(all=True)
+You can define the ``per_page`` value globally to avoid passing it to every
+``list()`` method call:
+
+.. code-block:: python
+
+ gl = gitlab.Gitlab(url, token, per_page=50)
+
``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:
diff --git a/docs/cli.rst b/docs/cli.rst
index 0e0d85b..654c00a 100644
--- a/docs/cli.rst
+++ b/docs/cli.rst
@@ -71,6 +71,10 @@ parameters. You can override the values in each GitLab server section.
* - ``api_version``
- ``3`` ou ``4``
- The API version to use to make queries. Requires python-gitlab >= 1.3.0.
+ * - ``per_page``
+ - Integer between 1 and 100
+ - The number of items to return in listing queries. GitLab limits the
+ value at 100.
You must define the ``url`` in each GitLab server section.