Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3aa9873

Browse files
Merge pull request#1003 from python-gitlab/feat/all-keyset-pagination
feat: use keyset pagination by default for `all=True`
2 parents745bdf7 +1609824 commit3aa9873

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

‎docs/api-usage.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,11 @@ listing methods support the ``page`` and ``per_page`` parameters:
204204
By default GitLab does not return the complete list of items. Use the ``all``
205205
parameter to get all the items when using listing methods:
206206

207+
..warning::
208+
209+
The all=True option uses keyset pagination by default if order_by is not supplied,
210+
or if order_by="id".
211+
207212
..code-block::python
208213
209214
all_groups= gl.groups.list(all=True)
@@ -391,4 +396,3 @@ parameter to that API invocation:
391396
392397
gl= gitlab.gitlab(url, token,api_version=4)
393398
gl.projects.import_github(ACCESS_TOKEN,123456,"root",timeout=120.0)
394-

‎gitlab/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,12 @@ def http_list(self, path, query_data=None, as_list=None, **kwargs):
640640
get_all=kwargs.pop("all",False)
641641
url=self._build_url(path)
642642

643+
# use keyset pagination automatically, if all=True
644+
order_by=kwargs.get("order_by")
645+
ifget_alland (notorder_byororder_by=="id"):
646+
kwargs["pagination"]="keyset"
647+
kwargs["order_by"]="id"
648+
643649
ifget_allisTrueandas_listisTrue:
644650
returnlist(GitlabList(self,url,query_data,**kwargs))
645651

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp