summaryrefslogtreecommitdiff
path: root/gitlab/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'gitlab/utils.py')
-rw-r--r--gitlab/utils.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/gitlab/utils.py b/gitlab/utils.py
new file mode 100644
index 0000000..181ca20
--- /dev/null
+++ b/gitlab/utils.py
@@ -0,0 +1,15 @@
+class _StdoutStream(object):
+ def __call__(self, chunk):
+ print(chunk)
+
+
+def response_content(response, streamed, action, chunk_size):
+ if streamed is False:
+ return response.content
+
+ if action is None:
+ action = _StdoutStream()
+
+ for chunk in response.iter_content(chunk_size=chunk_size):
+ if chunk:
+ action(chunk)