diff options
author | Max Wittig <max.wittig@siemens.com> | 2019-01-19 08:50:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-19 08:50:04 +0100 |
commit | 572029cd49fe356e38ee8bddc3dda3067cf868b0 (patch) | |
tree | 314b738f699f5138d91b79841a53bd17f0e62cc5 /gitlab | |
parent | 89679ce5ee502e57dbe7cec2b78f4f70b85fd3a5 (diff) | |
parent | 4bd027aac41c41f7e22af93c7be0058d2faf7fb4 (diff) | |
download | gitlab-572029cd49fe356e38ee8bddc3dda3067cf868b0.tar.gz |
Merge pull request #681 from python-gitlab/no-param-conflicts
fix(api): avoid parameter conflicts with python and gitlab
Diffstat (limited to 'gitlab')
-rw-r--r-- | gitlab/__init__.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/gitlab/__init__.py b/gitlab/__init__.py index c280974..4f00603 100644 --- a/gitlab/__init__.py +++ b/gitlab/__init__.py @@ -445,7 +445,20 @@ class Gitlab(object): params = {} utils.copy_dict(params, query_data) - utils.copy_dict(params, kwargs) + + # Deal with kwargs: by default a user uses kwargs to send data to the + # gitlab server, but this generates problems (python keyword conflicts + # and python-gitlab/gitlab conflicts). + # So we provide a `query_parameters` key: if it's there we use its dict + # value as arguments for the gitlab server, and ignore the other + # arguments, except pagination ones (per_page and page) + if 'query_parameters' in kwargs: + utils.copy_dict(params, kwargs['query_parameters']) + for arg in ('per_page', 'page'): + if arg in kwargs: + params[arg] = kwargs[arg] + else: + utils.copy_dict(params, kwargs) opts = self._get_session_opts(content_type='application/json') |