diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2017-11-10 09:09:18 +0100 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2017-11-10 09:09:18 +0100 |
commit | e9b158363e5b0ea451638b1c3a660f138a24521d (patch) | |
tree | 06700ef327e9ddec0b453938da593329a44e2da5 /docs/api-usage.rst | |
parent | ba6e09ec804bf5cea39282590bb4cb829a836873 (diff) | |
download | gitlab-e9b158363e5b0ea451638b1c3a660f138a24521d.tar.gz |
Rework authentication args handling
* Raise exceptions when conflicting arguments are used
* Build the auth headers when instanciating Gitlab, not on each request
* Enable anonymous Gitlab objects (#364)
Add docs and unit tests
Diffstat (limited to 'docs/api-usage.rst')
-rw-r--r-- | docs/api-usage.rst | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/docs/api-usage.rst b/docs/api-usage.rst index edd41d0..f60c0dc 100644 --- a/docs/api-usage.rst +++ b/docs/api-usage.rst @@ -20,11 +20,17 @@ To connect to a GitLab server, create a ``gitlab.Gitlab`` object: import gitlab # private token authentication - gl = gitlab.Gitlab('http://10.0.0.1', 'JVNSESs8EwWRx5yDxM5q') + gl = gitlab.Gitlab('http://10.0.0.1', private_token='JVNSESs8EwWRx5yDxM5q') - # or username/password authentication + # oauth token authentication + gl = gitlab.Gitlab('http://10.0.0.1', oauth_token='my_long_token_here') + + # username/password authentication gl = gitlab.Gitlab('http://10.0.0.1', email='jdoe', password='s3cr3t') + # anonymous gitlab instance, read-only for public resources + gl = gitlab.Gitlab('http://10.0.0.1') + # make an API request to create the gl.user object. This is mandatory if you # use the username/password authentication. gl.auth() |