Comment by

Example Python code:
import simplejson
import sys
import urllib

class ReviewBoard:
   def __init__(self, server, username, password):
     self.server = server
     self.username = username
     self.password = password

   def Run(self, command, params=None, throw=True):
     if params:
       params = urllib.urlencode(params)
     url = 'http://%s/api/json/%s/' % (self.server, command)
     f = urllib.urlopen(url, params)
     # TODO:(pv) Request Error handling...
     s =
     response = simplejson.loads(s)
     self.OK(response, throw)
     return response

   def OK(self, response, throw=False):
     ok = response['stat'] == 'ok'
     if not ok and throw:
       raise Exception('ReviewBoard response stat not "ok"')
     return ok

   def Login(self, username=None, password=None):
     if username is None:
       username = self.username
     if password is None:
       password = self.password
     rb.Run('accounts/login', {'username': username, 'password': password})

if __name__ == '__main__':
   reviewers = ['pv', 'lconley']
   rb = ReviewBoard('', 'pv', 'g00gl3')
   response = rb.Run('reviewrequests/11/reviews')
   reviews = response['reviews']
   for review in reviews:
     reviewer = review['user']['username']
     ship_it = review['ship_it']
     if reviewer in reviewers and ship_it:
       print '"%s" SAYS SHIP IT!' % reviewer.upper()

For more information:

You received this message because you are subscribed to the Google Groups 
"reviewboard-issues" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to