X-Git-Url: https://projects.mako.cc/source/mw/blobdiff_plain/b237e6295cb93a19ae1c7302ac47faeac5a53fc6..a77592fd9d9bd47d07f6e72d5a4fe7fa95ad53b5:/src/mw/clicommands.py diff --git a/src/mw/clicommands.py b/src/mw/clicommands.py index 9d8b2dc..f39cf8d 100644 --- a/src/mw/clicommands.py +++ b/src/mw/clicommands.py @@ -57,6 +57,16 @@ class CommandBase(object): if result['login']['result'] == 'Success': # cookies are saved to a file print 'Login successful! (yay)' + elif result['login']['result'] == 'NeedToken': + print 'Login with token' + result = self.api.call({'action': 'login', + 'lgname': user, + 'lgpassword': passwd, + 'lgtoken': result['login']['token']}) + if result['login']['result'] == 'Success': + print 'Login successful! (yay)' + else: + print 'Login failed: %s' % result['login']['result'] else: print 'Login failed: %s' % result['login']['result'] @@ -180,6 +190,10 @@ class CommitCommand(CommandBase): self.parser.add_option('-m', '--message', dest='edit_summary', help='don\'t prompt for edit summary and ' 'use this instead') + self.parser.add_option('--bot', dest='bot', action='store_true', + help='mark actions as a bot (won\'t affect ' + 'anything if you don\'t have the bot right', + default=False) def _do_command(self): self._die_if_no_init() @@ -231,6 +245,8 @@ class CommitCommand(CommandBase): 'md5': textmd5, 'summary': edit_summary, } + if self.options.bot: + data['bot'] = 'bot' response = self.api.call(data) if response['edit']['result'] == 'Success': data = {