summaryrefslogtreecommitdiff
path: root/obsapi/httpapi.py
diff options
context:
space:
mode:
authorScott Bahling <sbahling@suse.de>2018-08-03 16:42:16 +0200
committerScott Bahling <sbahling@suse.de>2018-08-03 16:42:41 +0200
commitb15e41a14f03d66f54353a7185cc57319c16ee17 (patch)
tree33f4bf8034060398f7248987a379da456ad32c52 /obsapi/httpapi.py
parent494f2c4dc9c5d1937545e0af54345c4d0d578bee (diff)
downloadobsapi-b15e41a14f03d66f54353a7185cc57319c16ee17.tar.gz
obsapi-b15e41a14f03d66f54353a7185cc57319c16ee17.tar.xz
obsapi-b15e41a14f03d66f54353a7185cc57319c16ee17.zip
Add streaming option for HTTP get method
Diffstat (limited to 'obsapi/httpapi.py')
-rw-r--r--obsapi/httpapi.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/obsapi/httpapi.py b/obsapi/httpapi.py
index ea0c9fb..6a207ec 100644
--- a/obsapi/httpapi.py
+++ b/obsapi/httpapi.py
@@ -52,10 +52,13 @@ class ObsHttpApi(object):
url = '{0}{1}{2}'.format(self.apiurl, self.rootapi, api)
+ stream = params.pop('stream', False)
+
def try_get():
r = requests.get(url,
auth=self.__auth,
params=params,
+ stream=stream,
verify=self.verify_ssl)
self._response = r
return r
@@ -112,11 +115,14 @@ class ObsHttpApi(object):
def get(self, *args, **params):
binary_get = params.pop('binary_get', False)
api = self.__api(*args)
+ stream = params.get('stream', False)
r = self.__api_get(api, params=params)
if not self.success:
- return self.default_xml
+ return None
if binary_get:
+ if stream:
+ return r
return r.content
return r.text