Diff for "API/Examples"

Not logged in - Log In / Register

Differences between revisions 2 and 5 (spanning 3 versions)
Revision 2 as of 2009-11-17 05:45:18
Size: 1121
Editor: 63
Comment:
Revision 5 as of 2009-11-25 17:24:43
Size: 926
Editor: 70-8-217-239
Comment: Mention API/Uses.
Deletions are marked like this. Additions are marked like this.
Line 7: Line 7:
If this duplicates [[API/launchpadlib|launchpadlib]] too much, then please merge the two pages. If this duplicates [[API/launchpadlib|launchpadlib]] or [[API/Uses|API/Uses]] too much, then please merge or edit pages as needed.
Line 15: Line 15:
from launchpadlib.launchpad import Launchpad, LPNET_SERVICE_ROOT from launchpadlib.launchpad import Launchpad
Line 17: Line 17:
    'hello-world', LPNET_SERVICE_ROOT, '/tmp/launchpad-cache')     'hello-world', 'production')
Line 21: Line 21:
The `hello-world` bit is the name of the application, `LPNET_SERVICE_ROOT` means connect to the production server and `/tmp/launchpad-cache` is a path to a cache where launchpadlib keeps all of its objects. You generally want the cache to be somewhere in the running user's home directory. The `hello-world` bit is the name of the application and `production` means connect to the production server.

Launchpad Help > API > Examples

This page has a bunch of examples of how to use launchpadlib and the Python APIs. Think of it like a cookbook that you can add your favourite recipe to.

If this duplicates launchpadlib or API/Uses too much, then please merge or edit pages as needed.

Hello Launchpad!

Ever wanted to have Launchpad greet you by your own name? Now you can, in the comfort of your own home.

   1 from launchpadlib.launchpad import Launchpad
   2 launchpad = Launchpad.login_with(
   3     'hello-world', 'production')
   4 print 'Hello, %s!' % launchpad.me.display_name

The hello-world bit is the name of the application and production means connect to the production server.

API/Examples (last edited 2016-04-15 18:13:29 by cjwatson)