| 1 |
******************** |
| 2 |
Command-line scripts |
| 3 |
******************** |
| 4 |
|
| 5 |
Launchpad includes one command-line script to make Launchpad |
| 6 |
integration easier for third-party libraries that aren't written in |
| 7 |
Python. |
| 8 |
|
| 9 |
This file tests the workflow underlying the command-line script as |
| 10 |
best it can. |
| 11 |
|
| 12 |
RequestTokenApp |
| 13 |
=============== |
| 14 |
|
| 15 |
This class is called by the command-line script |
| 16 |
launchpad-request-token. It creates a request token on a given |
| 17 |
Launchpad installation, and returns a JSON description of the request |
| 18 |
token and the available access levels. |
| 19 |
|
| 20 |
>>> import json |
| 21 |
>>> from launchpadlib.apps import RequestTokenApp |
| 22 |
|
| 23 |
>>> web_root = "http://launchpad.test:8085/" |
| 24 |
>>> consumer_name = "consumer" |
| 25 |
>>> token_app = RequestTokenApp(web_root, consumer_name, "context") |
| 26 |
>>> token_json = json.loads(token_app.run()) |
| 27 |
|
| 28 |
>>> for param in sorted(token_json.keys()): |
| 29 |
... print(param) |
| 30 |
access_levels |
| 31 |
lp.context |
| 32 |
oauth_token |
| 33 |
oauth_token_consumer |
| 34 |
oauth_token_secret |
| 35 |
|
| 36 |
>>> print(token_json['lp.context']) |
| 37 |
context |
| 38 |
|
| 39 |
>>> print(token_json['oauth_token_consumer']) |
| 40 |
consumer |