diff options
| author | Gauvain Pocentek <gauvain@pocentek.net> | 2016-07-17 14:09:39 +0200 |
|---|---|---|
| committer | Gauvain Pocentek <gauvain@pocentek.net> | 2016-07-17 14:09:39 +0200 |
| commit | 94aea524a23ac428259bae327a1fccdd2f5b841d (patch) | |
| tree | f8c3c8a90f4baf8ef271f6df3572de7991bbe22c /gitlab/__init__.py | |
| parent | 8e6a9442324926ed1dec0a8bfaf77792e4bdb10f (diff) | |
| download | gitlab-94aea524a23ac428259bae327a1fccdd2f5b841d.tar.gz | |
Allow to stream the downloads when appropriate
Some API calls will download possibly large data, resulting in a high
memory usage and out-of-memory errors. For these API calls use the
requests streaming capabilities and download chunked data. The caller is
responsible of providing a callable to actually store the data.
The default callable just prints the data on stdout.
Diffstat (limited to 'gitlab/__init__.py')
| -rw-r--r-- | gitlab/__init__.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gitlab/__init__.py b/gitlab/__init__.py index 6aa9c18..d702f31 100644 --- a/gitlab/__init__.py +++ b/gitlab/__init__.py @@ -286,7 +286,7 @@ class Gitlab(object): self.email = email self.password = password - def _raw_get(self, path, content_type=None, **kwargs): + def _raw_get(self, path, content_type=None, streamed=False, **kwargs): url = '%s%s' % (self._url, path) headers = self._create_headers(content_type) try: @@ -295,6 +295,7 @@ class Gitlab(object): headers=headers, verify=self.ssl_verify, timeout=self.timeout, + stream=streamed, auth=requests.auth.HTTPBasicAuth( self.http_username, self.http_password)) |
