commit 3613785cadc71d0e1f6a29fec1336f25b098d157 Author: Pierre-Yves Chibon pingou@pingoured.fr Date: Thu Mar 6 11:52:36 2014 +0100
Add get_packager_acls method to retrieve the ACLs of a packager via the API
pkgdb.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-) --- diff --git a/pkgdb.py b/pkgdb.py index 548a230..9d5a472 100644 --- a/pkgdb.py +++ b/pkgdb.py @@ -356,6 +356,44 @@ class PkgDB(object):
return output
+ def get_packager_acls(self, username, page=1, limit=250, count=False): + ''' Return the list of packagers matching the provided criterias. + + :arg username: + + ''' + def _get_pages(page): + args = { + 'username': username, + 'page': page, + 'limit': limit, + } + if count is True: + args['count'] = count + + req = self.session.get( + '{0}/api/packager/acl/'.format(self.url), params=args + ) + LOG.debug('Called: %s with arg %s', req.url, args) + + output = req.json() + + if req.status_code != 200: + LOG.debug('full output %s', output) + raise PkgDBException(output['error']) + + return output + + output = _get_pages(1) + + page = output['page'] + total = output['page_total'] + for i in range(2, total + 1): + data = _get_pages(i) + output['packages'].extend(output['packages']) + + return output + def orphan_packages(self, packages, branches): ''' Orphans the provided list of packages on the provided list of branches.
packagedb-cli-commits@lists.stg.fedorahosted.org