summaryrefslogtreecommitdiff
path: root/obsapi/buildapi.py
diff options
context:
space:
mode:
Diffstat (limited to 'obsapi/buildapi.py')
-rw-r--r--obsapi/buildapi.py67
1 files changed, 62 insertions, 5 deletions
diff --git a/obsapi/buildapi.py b/obsapi/buildapi.py
index 27e9124..d665612 100644
--- a/obsapi/buildapi.py
+++ b/obsapi/buildapi.py
@@ -1,9 +1,41 @@
# -*- coding: utf-8 -*-
-#
+"""
+Python OBS 'source' API
+~~~~~~~~~~~~~~~~~~~~~~~
+
+This module provides the ObsSourceAPI class used for accessing
+the `Open Build Service <https://openbuildservice.org/>'_ APIs
+related to `sources <https://build.opensuse.org/apidocs/index>`_.
+
+:copyright: Copyright (c) 2015-2020 Scott Bahling
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2 as
+ published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program (see the file COPYING); if not, write to the
+ Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+:license: GPL-2.0, see COPYING for details
+"""
+
from obsapi.httpapi import ObsHttpApi
class ObsBuildApi(ObsHttpApi):
+ """Class for low level access to OBS 'build' apis.
+
+ This class of the provides get, put, post methods for accessing Open
+ Build Service APIs under base `/build` api route.
+
+ Attributes
+
+ """
rootapi = '/build/'
@@ -17,11 +49,36 @@ class ObsBuildApi(ObsHttpApi):
return super(ObsBuildApi, self).post(*args, **kwargs)
def get(self, prj=None, repo=None, arch=None, pkg=None, binaryname=None,
- view=None, binary_get=False, **kwargs):
- if binaryname:
- binary_get = True
+ **kwargs):
+ """
+ Send GET request to the OBS API under the '/build' route.
+
+ :param prj: OBS project name (Default value = None)
+ :param repo: Project repo name (Default value = None)
+ :param arch: Build architecture (Default value = None)
+ :param pkg: OBS package name (Default value = None)
+ :param binaryname: Build result binary file name (Default value = None)
+ :param **kwargs: HTTP query key/value pairs
+ :returns: content payload of the HTTP response as string or bytes
+
+ Calls GET build/<prj>/<repo>/<arch>/<pkg>/<binaryname>?<params>
+
+ """
+ errormsg = []
+ if binaryname and not pkg:
+ errormsg.append('Expect pkg argument when passing binaryname')
+ if pkg and not arch:
+ errormsg.append('Expect arch argument when passing pkg')
+ if arch and not repo:
+ errormsg.append('Expect repo argument when passing arch')
+ if repo and not prj:
+ errormsg.append('Expect prj argument when passing repo')
+ if errormsg:
+ raise ValueError('\n'.join(errormsg))
+
+ binary_get = (binaryname is not None)
return self.__get(prj, repo, arch, pkg, binaryname,
- view=view, binary_get=binary_get, **kwargs)
+ binary_get=binary_get, **kwargs)
def get_builddepinfo(self, prj, repo, arch, pkg):
return self.__get(prj, repo, arch, '_builddepinfo', package=pkg)