Skip to content

Commit

Permalink
Merge pull request #1624 from axl89/docs-clarification
Browse files Browse the repository at this point in the history
Clarified CI Job Token auth() caveats
  • Loading branch information
nejch committed Oct 8, 2021
2 parents 7753fa2 + 3f423ef commit 49fae96
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/api-usage.rst
Expand Up @@ -29,14 +29,17 @@ To connect to GitLab.com or another GitLab instance, create a ``gitlab.Gitlab``
gl = gitlab.Gitlab('https://gitlab.example.com', oauth_token='my_long_token_here')
# job token authentication (to be used in CI)
# bear in mind the limitations of the API endpoints it supports:
# https://docs.gitlab.com/ee/ci/jobs/ci_job_token.html
import os
gl = gitlab.Gitlab('https://gitlab.example.com', job_token=os.environ['CI_JOB_TOKEN'])
# Define your own custom user agent for requests
gl = gitlab.Gitlab('https://gitlab.example.com', user_agent='my-package/1.0.0')
# make an API request to create the gl.user object. This is mandatory if you
# use the username/password authentication.
# use the username/password authentication - not required for token authentication,
# and will not work with job tokens.
gl.auth()
You can also use configuration files to create ``gitlab.Gitlab`` objects:
Expand Down

0 comments on commit 49fae96

Please sign in to comment.