pythonreview-boardrbtools

Python RBTools: get reviewers


I have a RB root:

api_client = RBClient(...)
root = api_client.get_root()

I can get files associated with a review request via:

files = root.get_files(review_request_id=1, diff_revision=1)

I would like to get information about Reviewers(group, people) for this review request, id 1

What can I do to get that information?

something like root.get_reviewers(review_request_id=1)


Solution

  • You need to first get the review object, from there get to the list of reviewers:

    import sys
    from rbtools.api.client import RBClient
    
    
    if __name__ == '__main__':
        client = RBClient('http://reviewboard/')
        root = client.get_root()
    
        review = root.get_review_request(review_request_id=sys.argv[1])
        for reviewer in review.target_people:
            print '{}, {}'.format(reviewer.title, reviewer.href)