1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# -*- 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 ObsSourceApi(ObsHttpApi):
rootapi = '/source/'
def __get(self, *args, **kwargs):
return super(ObsSourceApi, self).get(*args, **kwargs)
def __put(self, *args, **kwargs):
return super(ObsSourceApi, self).put(*args, **kwargs)
def __post(self, *args, **kwargs):
return super(ObsSourceApi, self).post(*args, **kwargs)
def get(self, prj=None, pkg=None, filename=None, binary_get=None, **kwargs):
if filename:
binary_get = True
return self.__get(prj, pkg, filename, binary_get=binary_get, **kwargs)
def put(self, prj, pkg=None, filename=None, data=None, **kwargs):
return self.__put(prj, pkg, filename, data, **kwargs)
def post(self, prj, pkg=None, filename=None, data=None, **kwargs):
return self.__post(prj, pkg, filename, data, **kwargs)
def get_meta(self, prj, pkg=''):
return self.__get(prj, pkg, '_meta')
def put_meta(self, prj, pkg=None, meta=None):
return self.__put(prj, pkg, '_meta', data=meta)
def get_attribute(self, prj, pkg=None, binary=None, attribute=None):
return self.__get(prj, pkg, binary, '_attribute', attribute)
def get_config(self, prj):
return self.__get(prj, '_config')
def put_config(self, prj, data):
return self.__put(prj, '_config', data=data)
def get_pattern(self, prj, patternfile=''):
return self.__get(prj, '_pattern', patternfile)
def put_pattern(self, prj, patternfile, data):
return self.__put(prj, '_pattern', patternfile, data=data)
def get_pubkey(self, prj):
return self.__get(prj, '_pubkey')
def get_history(self, prj, pkg):
return self.__get(prj, pkg, '_history')
|