diff options
| author | Scott Bahling <sbahling@suse.de> | 2018-07-18 17:23:15 +0200 |
|---|---|---|
| committer | Scott Bahling <sbahling@suse.de> | 2018-07-18 17:23:15 +0200 |
| commit | 84de1851f6982ca73a2f82eb382ff3f13742e31f (patch) | |
| tree | 21ecd79718b597d35b843924939a343f77073c99 /obsapi | |
| parent | 243c10a0283e0b93104f106fb78f151beb54aa38 (diff) | |
| download | obsapi-84de1851f6982ca73a2f82eb382ff3f13742e31f.tar.gz obsapi-84de1851f6982ca73a2f82eb382ff3f13742e31f.tar.xz obsapi-84de1851f6982ca73a2f82eb382ff3f13742e31f.zip | |
Handle retrieving binary files properly
Diffstat (limited to 'obsapi')
| -rw-r--r-- | obsapi/buildapi.py | 8 | ||||
| -rw-r--r-- | obsapi/httpapi.py | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/obsapi/buildapi.py b/obsapi/buildapi.py index eceea4d..698e5e7 100644 --- a/obsapi/buildapi.py +++ b/obsapi/buildapi.py @@ -13,8 +13,12 @@ class ObsBuildApi(ObsHttpApi): def __put(self, *args, **kwargs): return super(ObsBuildApi, self).put(*args, **kwargs) - def get(self, prj='', repo='', arch='', pkg='', binaryname='', view=None): - return self.__get(prj, repo, arch, pkg, binaryname, view=view) + def get(self, prj='', repo='', arch='', pkg='', binaryname='', + view=None, binary_get=False): + if binaryname: + binary_get = True + return self.__get(prj, repo, arch, pkg, binaryname, + view=view, binary_get=binary_get) def get_builddepinfo(self, prj, pkg, repo, arch): return self.__get(prj, repo, arch, '_builddepinfo', package=pkg) diff --git a/obsapi/httpapi.py b/obsapi/httpapi.py index 4b0ab65..8ef893e 100644 --- a/obsapi/httpapi.py +++ b/obsapi/httpapi.py @@ -110,11 +110,15 @@ class ObsHttpApi(object): return '/'.join(['{}'] * len(args)).format(*args) def get(self, *args, **params): + binary_get = params.pop('binary_get', False) api = self.__api(*args) r = self.__api_get(api, params=params) if not self.success: return self.default_xml + if binary_get: + return r.content + return r.text def put(self, *args, **kwargs): |
