@@ -23,9 +23,6 @@ To connect to a GitLab server, create a ``gitlab.Gitlab`` object:
2323 import os
2424 gl = gitlab.Gitlab(' http://10.0.0.1' , job_token = os.environ[' CI_JOB_TOKEN' ])
2525
26- # username/password authentication (for GitLab << 10.2)
27- gl = gitlab.Gitlab(' http://10.0.0.1' , email = ' jdoe' , password = ' s3cr3t' )
28-
2926 # anonymous gitlab instance, read-only for public resources
3027 gl = gitlab.Gitlab(' http://10.0.0.1' )
3128
@@ -219,6 +216,18 @@ You can define the ``per_page`` value globally to avoid passing it to every
219216
220217 gl = gitlab.Gitlab(url, token, per_page = 50 )
221218
219+ Gitlab allows to also use keyset pagination. You can supply it to your project listing,
220+ but you can also do so globally. Be aware that GitLab then also requires you to only use supported
221+ order options. At the time of writing, only ``order_by="id" `` works.
222+
223+ .. code-block :: python
224+
225+ gl = gitlab.Gitlab(url, token, pagination = " keyset" , order_by = " id" , per_page = 100 )
226+ gl.projects.list()
227+
228+ Reference:
229+ https://docs.gitlab.com/ce/api/README.html#keyset-based-pagination
230+
222231``list() `` methods can also return a generator object which will handle the
223232next calls to the API when required. This is the recommended way to iterate
224233through a large number of items:
@@ -348,3 +357,38 @@ throttled, you can set this parameter to -1. This parameter is ignored if
348357 .. warning ::
349358
350359 You will get an Exception, if you then go over the rate limit of your GitLab instance.
360+
361+ Transient errors
362+ ----------------
363+
364+ GitLab server can sometimes return a transient HTTP error.
365+ python-gitlab can automatically retry in such case, when
366+ ``retry_transient_errors `` argument is set to ``True ``. When enabled,
367+ HTTP error codes 500 (Internal Server Error), 502 (502 Bad Gateway),
368+ 503 (Service Unavailable), and 504 (Gateway Timeout) are retried. By
369+ default an exception is raised for these errors.
370+
371+ .. code-block :: python
372+
373+ import gitlab
374+ import requests
375+
376+ gl = gitlab.gitlab(url, token, api_version = 4 )
377+ gl.projects.list(all = True , retry_transient_errors = True )
378+
379+ Timeout
380+ -------
381+
382+ python-gitlab will by default use the ``timeout `` option from it's configuration
383+ for all requests. This is passed downwards to the ``requests `` module at the
384+ time of making the HTTP request. However if you would like to override the
385+ global timeout parameter for a particular call, you can provide the ``timeout ``
386+ parameter to that API invocation:
387+
388+ .. code-block :: python
389+
390+ import gitlab
391+
392+ gl = gitlab.gitlab(url, token, api_version = 4 )
393+ gl.projects.import_github(ACCESS_TOKEN , 123456 , " root" , timeout = 120.0 )
394+
0 commit comments