~ubuntu-branches/ubuntu/vivid/lazr.restfulclient/vivid-proposed

« back to all changes in this revision

Viewing changes to src/lazr/restfulclient/docs/authorizer.standalone.txt

  • Committer: Bazaar Package Importer
  • Author(s): Luca Falavigna
  • Date: 2011-02-14 21:42:26 UTC
  • mfrom: (1.3.1 upstream) (13.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20110214214226-zeqsgvl9th92gadm
Tags: 0.11.2-1
* New upstream release.
* Upload to unstable.
* debian/pydist-overrides:
  - Do not require wsgi_intercept as dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
186
186
 
187
187
But valid credentials work fine (again, up to the point at which
188
188
lazr.restfulclient runs against the limits of this simple web
189
 
service). Note that the User-Agent header mentions the name of the
190
 
OAuth consumer.
 
189
service). Note that the User-Agent header mentions the consumer key.
191
190
 
192
191
    >>> httplib2.debuglevel = 1
193
192
    >>> authorizer = OAuthAuthorizer(
194
193
    ...     valid_consumer.key, access_token=valid_token)
195
194
    >>> client = ServiceRoot(authorizer, "http://api.launchpad.dev/")
196
 
    send: 'GET /...user-agent: lazr.restfulclient... oauth_consumer="consumer"...'
197
 
    ...
 
195
    send: 'GET /...user-agent: lazr.restfulclient...; oauth_consumer="consumer"...'
 
196
    ...
 
197
 
 
198
If the OAuthAuthorizer is created with an application name as well as
 
199
a consumer key, the application name is mentioned in the User-Agent
 
200
header as well.
 
201
 
 
202
    >>> authorizer = OAuthAuthorizer(
 
203
    ...     valid_consumer.key, access_token=valid_token,
 
204
    ...     application_name="the app")
 
205
    >>> client = ServiceRoot(authorizer, "http://api.launchpad.dev/")
 
206
    send: 'GET /...user-agent: lazr.restfulclient...; application="the app"; oauth_consumer="consumer"...'
 
207
    ...
 
208
 
198
209
    >>> httplib2.debuglevel = 0
199
210
 
200
211
It's even possible to get anonymous access by providing an empty