command-line.rst 1.1 KB

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