diff options
author | Max Wittig <max.wittig@siemens.com> | 2019-01-19 14:10:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-19 14:10:24 +0100 |
commit | 52d76312660109d3669d459b11b448a3a60b9603 (patch) | |
tree | e14cef27760e1c022e68757c88a5eca296c580bc /gitlab/__init__.py | |
parent | ca8c85cf3ed4d4d62fc86a3b52ea8a5c4f2d0cd0 (diff) | |
parent | 35a6d85acea4776e9c4ad23ff75259481a6bcf8d (diff) | |
download | gitlab-52d76312660109d3669d459b11b448a3a60b9603.tar.gz |
Merge pull request #687 from python-gitlab/fix/683/raw_download
fix(api): Don't try to parse raw downloads
Diffstat (limited to 'gitlab/__init__.py')
-rw-r--r-- | gitlab/__init__.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gitlab/__init__.py b/gitlab/__init__.py index 4f00603..0e6e52f 100644 --- a/gitlab/__init__.py +++ b/gitlab/__init__.py @@ -530,7 +530,8 @@ class Gitlab(object): error_message=error_message, response_body=result.content) - def http_get(self, path, query_data={}, streamed=False, **kwargs): + def http_get(self, path, query_data={}, streamed=False, raw=False, + **kwargs): """Make a GET request to the Gitlab server. Args: @@ -538,6 +539,7 @@ class Gitlab(object): 'http://whatever/v4/api/projecs') query_data (dict): Data to send as query parameters streamed (bool): Whether the data should be streamed + raw (bool): If True do not try to parse the output as json **kwargs: Extra options to send to the server (e.g. sudo) Returns: @@ -551,8 +553,10 @@ class Gitlab(object): """ result = self.http_request('get', path, query_data=query_data, streamed=streamed, **kwargs) - if (result.headers['Content-Type'] == 'application/json' and - not streamed): + + if (result.headers['Content-Type'] == 'application/json' + and not streamed + and not raw): try: return result.json() except Exception: |