diff --git a/doc/manage-credentials.1 b/doc/manage-credentials.1 index b0bf04d..90429b8 100644 --- a/doc/manage-credentials.1 +++ b/doc/manage-credentials.1 @@ -47,23 +47,16 @@ Launchpad token. 0 is unauthorized, 1 is read public data, 2; write public data, 3; read private data and 4; write private data. .SH EXAMPLE USAGE -There are currently two ways of using \fBmanage-credentials\fR to get -Launchpad tokens. +To get Launchpad tokens using \fBmanage-credentials\fR, run the following command: .TP -1) manage-credentials create \-c CONSUMER \-\-level 2 +manage-credentials create \-c CONSUMER \-\-level 2 .TP -This way shall open your webbrowser with a Launchpad login page. - -.TP -2) manage-credentials create \-c CONSUMER \-\-level 2 \-\-password BOO \-\-email me@example.com - -.TP -This is a hack, but it works and does not require a webbrowser . +This will open your web browser with a Launchpad login page. .TP If you intend to use manage-credentials for Ubuntu development (such as -the ubuntu-dev-tools package). Please by sure to run the following: +the ubuntu-dev-tools package). Please be sure to run the following: .TP manage-credentials create \-c ubuntu-dev-tools \-l 2 diff --git a/manage-credentials b/manage-credentials index 679d714..2e60de9 100755 --- a/manage-credentials +++ b/manage-credentials @@ -23,21 +23,17 @@ import os import sys from optparse import OptionParser, make_option from launchpadlib.uris import lookup_service_root -from ubuntutools.lp.libsupport import * +from ubuntutools.lp.libsupport import Launchpad, translate_web_api, LEVEL class CmdOptions(OptionParser): USAGE = ( - "\t%prog create -c [--email --password ] [--service ]" + "\t%prog create -c [--service ]" ) OPTIONS = ( make_option("-c", "--consumer", action="store", type="string", dest="consumer", default=None), - make_option("-e", "--email", action="store", type="string", - dest="email", default=None), - make_option("-p", "--password", action="store", type="string", - dest="password", default=None), make_option("-s", "--service", action="store", type="string", dest="service", default="edge"), make_option("--cache", action="store", type="string", @@ -51,7 +47,7 @@ class CmdOptions(OptionParser): TOOLS = { "create": ( ("consumer",), - ("email", "password", "service", "cache", "output", + ("service", "cache", "output", "level")), "list": (tuple(), ("service", )), } @@ -88,17 +84,10 @@ class CmdOptions(OptionParser): return tool, options def create_credentials(options): - if options.password and options.email: - # use hack - credentials = Credentials(options.consumer) - credentials = approve_application(credentials, options.email, - options.password, options.level, - translate_api_web(options.service), None) - else: - launchpad = Launchpad.get_token_and_login(options.consumer, - options.service, options.cache) - credentials = launchpad.credentials - + launchpad = Launchpad.get_token_and_login(options.consumer, + options.service, options.cache) + credentials = launchpad.credentials + if options.output: filepath = options.output else: