@@ -93,20 +93,26 @@ Examples:
93
93
..code-block ::python
94
94
95
95
# list all the projects
96
- projects= gl.projects.list()
96
+ projects= gl.projects.list(as_list = False )
97
97
for projectin projects:
98
98
print (project)
99
99
100
100
# get the group with id == 2
101
101
group= gl.groups.get(2 )
102
- for projectin group.projects.list():
102
+ for projectin group.projects.list(as_list = False ):
103
103
print (project)
104
104
105
105
# create a new user
106
106
user_data= {' email' :' jen@foo.com' ,' username' :' jen' ,' name' :' Jen' }
107
107
user= gl.users.create(user_data)
108
108
print (user)
109
109
110
+ ..warning ::
111
+ Calling ``list() `` without any arguments will by default not return the complete list
112
+ of items. Use either the ``all=True `` or ``as_list=False `` parameters to get all the
113
+ items when using listing methods. See the:ref: `pagination ` section for more
114
+ information.
115
+
110
116
You can list the mandatory and optional attributes for object creation and
111
117
update with the manager's ``get_create_attrs() `` and ``get_update_attrs() ``
112
118
methods. They return 2 tuples, the first one is the list of mandatory
@@ -133,7 +139,7 @@ Some objects also provide managers to access related GitLab resources:
133
139
134
140
# list the issues for a project
135
141
project= gl.projects.get(1 )
136
- issues= project.issues.list()
142
+ issues= project.issues.list(all = True )
137
143
138
144
python-gitlab allows to send any data to the GitLab server when making queries.
139
145
In case of invalid or missing arguments python-gitlab will raise an exception
@@ -150,9 +156,9 @@ conflict with python or python-gitlab when using them as kwargs:
150
156
151
157
..code-block ::python
152
158
153
- gl.user_activities.list(from = ' 2019-01-01' )# # invalid
159
+ gl.user_activities.list(from = ' 2019-01-01' , as_list = False )# # invalid
154
160
155
- gl.user_activities.list(query_parameters = {' from' :' 2019-01-01' })# OK
161
+ gl.user_activities.list(query_parameters = {' from' :' 2019-01-01' }, as_list = False )# OK
156
162
157
163
Gitlab Objects
158
164
==============
@@ -233,6 +239,8 @@ a project (the previous example used 2 API calls):
233
239
project= gl.projects.get(1 ,lazy = True )# no API call
234
240
project.star()# API call
235
241
242
+ .. _pagination :
243
+
236
244
Pagination
237
245
==========
238
246