Skip to content

Commit 29bd813

Browse files
author
Gauvain Pocentek
committed
config: support api_version in the global section
Fixes #421
1 parent 1ca3080 commit 29bd813

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

docs/cli.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ example:
3737
default = somewhere
3838
ssl_verify = true
3939
timeout = 5
40-
api_version = 3
4140
4241
[somewhere]
4342
url = https://some.whe.re
@@ -69,6 +68,9 @@ parameters. You can override the values in each GitLab server section.
6968
* - ``timeout``
7069
- Integer
7170
- Number of seconds to wait for an answer before failing.
71+
* - ``api_version``
72+
- ``3`` ou ``4``
73+
- The API version to use to make queries. Requires python-gitlab >= 1.3.0.
7274

7375
You must define the ``url`` in each GitLab server section.
7476

gitlab/config.py

+4
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ def __init__(self, gitlab_id=None, config_files=None):
129129
pass
130130

131131
self.api_version = '3'
132+
try:
133+
self.api_version = self._config.get('global', 'api_version')
134+
except Exception:
135+
pass
132136
try:
133137
self.api_version = self._config.get(self.gitlab_id, 'api_version')
134138
except Exception:

0 commit comments

Comments
 (0)