does not handle HTTP 301 "errors", should follow them
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lazr.restfulclient |
Triaged
|
Low
|
Unassigned |
Bug Description
Hello! I'm using the Launchpad API and finding that I get the following:
Traceback (most recent call last):
File "./release.py", line 117, in <module>
main(server, config.LP_USER, projectName, version)
File "./release.py", line 110, in main
releaser = Releaser(lp, projectName, version)
File "./release.py", line 17, in __init__
self.
File "./release.py", line 23, in _Initialize
self.Milestone = self.Project.
File "/usr/lib/
url, in_representation, http_method, extra_headers=
File "/usr/lib/
raise HTTPError(response, content)
lazr.restfulcli
This happens if I supply a project name of "Foo" when the project name in Launchpad is "foo". Because LP is case-insensitive, it redirects to the proper project, and it would be most convenient if lazr followed this, instead of treating a 301 as an error.
Thanks! Let me know if I can provide more information or if this belongs in another project.
Changed in lazr.restfulclient: | |
status: | New → Triaged |
importance: | Undecided → Medium |
Changed in lazr.restfulclient: | |
status: | Triaged → Fix Released |
status: | Fix Released → Confirmed |
Changed in lazr.restfulclient: | |
status: | Confirmed → Triaged |
Changed in lazr.restfulclient: | |
importance: | Medium → Low |
The error only occurs when invoking a named operation that results in a redirect. The underlying problem is that the HTTP method comes out of the WADL file in lowercase, and there's code in httplib2 that checks the HTTP method against a list of uppercase method names. "get" doesn't match "GET", so httplib2 thinks we're not doing a safe HTTP request and refuses to automatically follow the redirect.
I have a fix in lazr.restfulclient, but I'll need to add some code to lazr.restful to write a test for it. I should also file or find an httplib2 bug.