Merge lp:~leonardr/lazr.restfulclient/user-agent into lp:lazr.restfulclient
Status: | Merged |
---|---|
Approved by: | Aaron Bentley |
Approved revision: | 93 |
Merged at revision: | not available |
Proposed branch: | lp:~leonardr/lazr.restfulclient/user-agent |
Merge into: | lp:lazr.restfulclient |
Diff against target: |
241 lines (+89/-9) 7 files modified
src/lazr/restfulclient/NEWS.txt (+7/-1) src/lazr/restfulclient/_browser.py (+4/-1) src/lazr/restfulclient/authorize/__init__.py (+11/-0) src/lazr/restfulclient/authorize/oauth.py (+10/-0) src/lazr/restfulclient/docs/authorizer.txt (+18/-2) src/lazr/restfulclient/resource.py (+34/-3) src/lazr/restfulclient/tests/example.py (+5/-2) |
To merge this branch: | bzr merge lp:~leonardr/lazr.restfulclient/user-agent |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Aaron Bentley (community) | Approve | ||
Review via email: mp+23237@code.launchpad.net |
Description of the change
This branch makes lazr.restfulclient send out a real User-Agent string instead of the python/httplib2 default. The User-Agent consists of a number of segments encased in parentheses, like this:
(launchpadlib 1.6.1) (lazr.restfulclient 1.0.0) (OAuth consumer=apport) (+cache-control)
The first segment is optional; it's information provided by an application that builds on lazr.restfulclient (ie. launchpadlib). The second segment is lazr.restfulclient version information. The third is also optional, and it's information provided by the authorization method (in this case, the OAuth consumer key). The fourth is also optional: it's a series of short strings advertising the client's support for particular features that lazr.restful can't serve to everyone because they break clients that don't support them.
That fourth section (+cache-control) is the reason I'm doing this branch in the first place. I want an easy way to distinguish clients that have a workaround for http://
Unless there's a good reason not to, I think that you should do parameterization the way it's done in other HTTP headers, by appending a semicolon, and a list of x=y pairs. (e.g. Content-Type: text/html; charset= ISO-8859- 4).
I also suggest that since you only want to disable cache-control due to a bug in python's httplib2, you only disable it for the 'python/httplib2' user-agent, and omit the +cache-control value.