rbtools Python API client

Review Request #3184 — Created July 9, 2012 and submitted — Latest diff uploaded

Information

RBTools
master

Reviewers

This is the base of the new Python API Client. This includes the finished
synchronous transport, and the bare bones resource classes.

In order to support the full Web API, a few resource specific base classes need
to be added (To download diffs etc.). The current state allows for regular use
of the API, accessing resources, following links, and using the uri templates
from the root resource.

Acknowledgement: Alexander Solovets (mbait) provided initial design work, some
starting code, and inspiration for this implementation. His work set me in the
right direction, and is greatly appreciated.

Example Usage:
    from rbtools.api.client import RBClient

    username = None
    password = None
    url = 'http://reviews.reviewboard.org/api/'
    cookie = 'rbapi.cookie'

    client = RBClient(
        url,
        cookie_file=cookie,
        username=username,
        password=password)
    root = client.get_root()

    info = root.get_info()
    print info.product.version

    # Display the first review request.
    requests = root.get_review_requests()
    print requests[0].summary

    # Who are the reviewers?
    for person_link in requests[0].target_people:
        print person_link.get().fullname

    # Lets give a review.
    reviews = requests[0].get_reviews()
    review = reviews.create(
        data={
            'body_top': "Nice patch!",
        })
    review.update(data={'public': True})
Manual testing against local Review Board instance, and the r.rb.org instance. All non-resource-specific operations appear to work.