Umm, no, the problem is that ReviewBoard does *not* like a trailing slash. When I remove the trailing slash, all works well.
That's why I was so surprised that you returned the URL for the user record with a trailing slash. I have to strip it to make it work. Perhaps this is only an issue when using urllib2, since when I feed a trailing slash in a browser URL field it all works fine. But it sure does break in urllib2 with trailing slashes. Ken On Mar 27, 12:51 pm, Christian Hammond <chip...@chipx86.com> wrote: > Yeah, Review Board expects that every single URL is going to have a > trailing slash, and should generate each URL with one. Always assume that's > the case when building URLs and you should be okay. > > Christian > > -- > Christian Hammond - chip...@chipx86.com > Review Board -http://www.reviewboard.org > VMware, Inc. -http://www.vmware.com > > > > > > > > On Tue, Mar 27, 2012 at 10:53 AM, Ken Klingman <capt...@gmail.com> wrote: > > Problem solved. Beware of embedded and trailing slashes. > > I'd say to use the URL or URL templates as defined in the > > api, but ReviewBoard returns the user URL with a trailing > > slash. > > > Ken > > > On Tuesday, March 27, 2012 6:39:12 AM UTC-7, Ken Klingman wrote: > > >> Hi, > > >> Using the web services interface on 1.6.4.1 with a Python (2.7) script > >> and the urllib2 module I am getting an HTTP error 405 when requesting the > >> XML for an individual review (api/review-requests/<rb entry>), yet it works > >> just fine when I request the XML for the set of reviews for that individual > >> RB entry (api/review-requests/<rb entry>/reviews). Both URL's work fine, > >> returning appropriate XML when pasted into a browser. > > >> Both of the URL's worked fine with a previous ReviewBoard installation of > >> version 1.4.x. > > >> Here's a snippet of code that fails with the 405: > > >> #!/usr/bin/env python > > >> import urllib2 > > >> url = > >> "http://reviewboard/api/**review-requests/6721/<http://reviewboard/api/review-requests/6721/> > >> " > >> header = {'Accept': "application/xml"} > >> request = urllib2.Request(url, "", header) > >> f = urllib2.urlopen(request) > >> xml = f.read() > >> f.close() > >> print xml > > >> (replace reviewboard in the URL with the correct system name, redacted > >> for security) > > >> Traceback (most recent call last): > >> File "./t.pl", line 8, in <module> > >> f = urllib2.urlopen(request) > >> File "/usr/lib/python2.7/urllib2.**py", line 126, in urlopen > >> return _opener.open(url, data, timeout) > >> File "/usr/lib/python2.7/urllib2.**py", line 400, in open > >> response = meth(req, response) > >> File "/usr/lib/python2.7/urllib2.**py", line 513, in http_response > >> 'http', request, response, code, msg, hdrs) > >> File "/usr/lib/python2.7/urllib2.**py", line 438, in error > >> return self._call_chain(*args) > >> File "/usr/lib/python2.7/urllib2.**py", line 372, in _call_chain > >> result = func(*args) > >> File "/usr/lib/python2.7/urllib2.**py", line 521, in http_error_default > >> raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) > >> urllib2.HTTPError: HTTP Error 405: Method Not Allowed > > >> If I simply add "/reviews" to the URL, it works fine and I get the XML > >> returned with all the reviews. Incidentally, I also get a 405 when > >> accessing a RB user's set of XML (api/users/<rb username>). > > >> This has been driving me nuts, so any help would be greatly appreciated! > > >> Thanks, > >> Ken > > >> -- > > Want to help the Review Board project? Donate today at > >http://www.reviewboard.org/donate/ > > Happy user? Let us know athttp://www.reviewboard.org/users/ > > -~----------~----~----~----~------~----~------~--~--- > > To unsubscribe from this group, send email to > > reviewboard+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/reviewboard?hl=en -- Want to help the Review Board project? Donate today at http://www.reviewboard.org/donate/ Happy user? Let us know at http://www.reviewboard.org/users/ -~----------~----~----~----~------~----~------~--~--- To unsubscribe from this group, send email to reviewboard+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/reviewboard?hl=en