Diff for "API/Examples"

Not logged in - Log In / Register

Differences between revisions 1 and 2
Revision 1 as of 2009-11-02 20:45:06
Size: 229
Editor: 78-105-1-164
Comment:
Revision 2 as of 2009-11-17 05:45:18
Size: 1121
Editor: 63
Comment:
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
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 [[API/launchpadlib|launchpadlib]] too much, then please merge the two pages.
Line 6: Line 10:

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

{{{
#!python
from launchpadlib.launchpad import Launchpad, LPNET_SERVICE_ROOT
launchpad = Launchpad.login_with(
    'hello-world', LPNET_SERVICE_ROOT, '/tmp/launchpad-cache')
print 'Hello, %s!' % launchpad.me.display_name
}}}

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.

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 too much, then please merge the two pages.

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, LPNET_SERVICE_ROOT
   2 launchpad = Launchpad.login_with(
   3     'hello-world', LPNET_SERVICE_ROOT, '/tmp/launchpad-cache')
   4 print 'Hello, %s!' % launchpad.me.display_name

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.

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