@@ -19,13 +19,13 @@ To connect to a GitLab server, create a ``gitlab.Gitlab`` object:
1919
2020 import gitlab
2121
22- # private token authentication
22+ # private token or personal token authentication
2323 gl = gitlab.Gitlab(' http://10.0.0.1' , private_token = ' JVNSESs8EwWRx5yDxM5q' )
2424
2525 # oauth token authentication
2626 gl = gitlab.Gitlab(' http://10.0.0.1' , oauth_token = ' my_long_token_here' )
2727
28- # username/password authentication
28+ # username/password authentication (for GitLab << 10.2)
2929 gl = gitlab.Gitlab(' http://10.0.0.1' , email = ' jdoe' , password = ' s3cr3t' )
3030
3131 # anonymous gitlab instance, read-only for public resources
@@ -44,6 +44,21 @@ You can also use configuration files to create ``gitlab.Gitlab`` objects:
4444 See the :ref: `cli_configuration ` section for more information about
4545configuration files.
4646
47+ Note on password authentication
48+ -------------------------------
49+
50+ The ``/session `` API endpoint used for username/password authentication has
51+ been removed from GitLab in version 10.2, and is not available on gitlab.com
52+ anymore. Personal token authentication is the prefered authentication method.
53+
54+ If you need username/password authentication, you can use cookie-based
55+ authentication. You can use the web UI form to authenticate, retrieve cookies,
56+ and then use a custom ``requests.Session `` object to connect to the GitLab API.
57+ The following code snippet demonstrates how to automate this:
58+ https://gist.github.com/gpocentek/bd4c3fbf8a6ce226ebddc4aad6b46c0a.
59+
60+ See `issue 380 <https://github.com/python-gitlab/python-gitlab/issues/380 >`_
61+ for a detailed discussion.
4762
4863API version
4964===========
0 commit comments