@@ -7,13 +7,22 @@ python-gitlab only supports GitLab APIs v4.
77``gitlab.Gitlab `` class
88=======================
99
10- To connect to a GitLab server, create a ``gitlab.Gitlab `` object:
10+ To connect to GitLab.com or another GitLab server, create a ``gitlab.Gitlab `` object:
1111
1212.. code-block :: python
1313
1414 import gitlab
1515
16- # private token or personal token authentication
16+ # anonymous read-only access for public resources (GitLab.com)
17+ gl = gitlab.Gitlab()
18+
19+ # anonymous read-only access for public resources (self-hosted GitLab instance)
20+ gl = gitlab.Gitlab(' http://10.0.0.1' )
21+
22+ # private token or personal token authentication (GitLab.com)
23+ gl = gitlab.Gitlab(private_token = ' JVNSESs8EwWRx5yDxM5q' )
24+
25+ # private token or personal token authentication (self-hosted GitLab instance)
1726 gl = gitlab.Gitlab(' http://10.0.0.1' , private_token = ' JVNSESs8EwWRx5yDxM5q' )
1827
1928 # oauth token authentication
@@ -23,12 +32,6 @@ To connect to a GitLab server, create a ``gitlab.Gitlab`` object:
2332 import os
2433 gl = gitlab.Gitlab(' http://10.0.0.1' , job_token = os.environ[' CI_JOB_TOKEN' ])
2534
26- # anonymous gitlab instance, read-only for public resources
27- gl = gitlab.Gitlab(' http://10.0.0.1' )
28-
29- # Define your own custom user agent for requests
30- gl = gitlab.Gitlab(' http://10.0.0.1' , user_agent = ' my-package/1.0.0' )
31-
3235 # make an API request to create the gl.user object. This is mandatory if you
3336 # use the username/password authentication.
3437 gl.auth()
0 commit comments