1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3
# This file is in the public domain
11
from launchpadlib.launchpad import Launchpad
13
print >> sys.stderr, "In order to use the Launchpad API you'll need to \
14
install https://help.launchpad.net/API/launchpadlib"
18
print >> sys.stderr, "Can't proceed without a Launchpad credential."
22
def get_launchpad(use_staging = False):
23
cachedir = tempfile.mkdtemp()
24
atexit.register(shutil.rmtree, cachedir)
25
logging.info('Logging in to Launchpad...')
26
server = (lambda s: 'staging' if s else 'production')(use_staging)
27
launchpad = Launchpad.login_with('ul10n_tools',
30
credential_save_failed=no_credential)