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/"; 
> 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 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

Reply via email to