1258: Upload Diff with API

hart.*****@gmai***** (Google Code) (Is this you? Claim this profile.)
Oct. 9, 2009
What's the URL of the page containing the problem?
http://code.google.com/p/reviewboard/wiki/ReviewBoardAPI

Describe the problem and any recommendations below.
I'm trying to upload a diff to a review request that I previously created,
but I can't find how it works.
I know I have to use "'/api/json/reviewrequests/'+ review request id
+'/diff/new/'", but with witch arguments ?
#1 hart.*****@gmai***** (Google Code) (Is this you? Claim this profile.)
For those who wants to know, I use MultipartPostHandler script
(http://pipe.scs.fsu.edu/PostHandler/MultipartPostHandler.py).

 cookiejar = cookielib.CookieJar()
 multi = MultipartPostHandler()
 urlopener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookiejar), multi)

 #make a temporary file
 nu, tmpfile = mkstemp()
 fd = open(tmpfile, 'w')
 fd.write(diff)
 fd.close()
 fd = open(tmpfile, 'r')
 params = {'path': fd}

 res = json.loads(urlopener.open(REVIEWBOARD_URL+'/api/json/reviewrequests/'+
str(rrid) +'/diff/new/', params).read())
    
 # remove the temporary file
 os.unlink(tmpfile)
chipx86
#2 chipx86
You should take a look at post-review, which does exactly this, if you haven't already.
  • +NotABug