"""Set SR state."""
return core.change_request_state(self.apiurl, reqid, state,
message=message, force=force)
+
+ def get_srs(self, prj, states=None, pkg=None):
+ """
+ Get SRs for the project (and package).
+
+ Args:
+ prj (str): OBS project name
+ states (str): comma-separated list of states, e.g. 'new,accepted'
+ pkg (str): package name
+
+ Yields:
+ id, state, description of found SRs
+ """
+ query = 'view=collection&types=submit&project=%s' % prj
+ if states:
+ query += '&states=%s' % states
+ if pkg:
+ query += '&package=%s' % pkg
+ url = core.makeurl(self.apiurl, ['request'], query)
+
+ root = ET.parse(self.core_http(core.http_GET, url))
+ for sr in root.findall('request'):
+ yield sr.get('id'), sr.find('state').get('name'), \
+ sr.find('description').text