diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2017-10-21 08:59:14 +0200 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2017-10-21 08:59:14 +0200 |
commit | 1b5d4809d8a6a5a6b130265d5ab8fb97fc725ee8 (patch) | |
tree | dc50068c97e9e1a1117eccfd4b5ab5b0b95f5905 /docs/api-usage.rst | |
parent | b23e344c89c26dd782ec5098b65b226b3323d6eb (diff) | |
download | gitlab-1b5d4809d8a6a5a6b130265d5ab8fb97fc725ee8.tar.gz |
Document the Gitlab session parameter
Provide a proxy setup example.
Closes #341
Diffstat (limited to 'docs/api-usage.rst')
-rw-r--r-- | docs/api-usage.rst | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/docs/api-usage.rst b/docs/api-usage.rst index 4fefd08..c27ba25 100644 --- a/docs/api-usage.rst +++ b/docs/api-usage.rst @@ -234,3 +234,27 @@ user. For example: .. code-block:: python p = gl.projects.create({'name': 'awesome_project'}, sudo='user1') + +Advanced HTTP configuration +=========================== + +python-gitlab relies on ``requests`` ``Session`` objects to perform all the +HTTP requests to the Gitlab servers. + +You can provide your own ``Session`` object with custom configuration when +you create a ``Gitlab`` object. + +The following sample illustrates how to define a proxy configuration when using +python-gitlab: + +.. code-block:: python + + import gitlab + import requests + + session = requests.Session() + session.proxies = { + 'https': os.environ.get('https_proxy'), + 'http': os.environ.get('http_proxy'), + } + gl = gitlab.gitlab(url, token, api_version=4, session=session) |