def main(): # load basic config info config_info = config.load_default_config_info() # run the program handler = ArgumentHandler('enchant', use_subcommand_help=True) handler.set_logging_argument('-L') handler.add_argument('-H', '--host', default=config_info.host, help='the host for the enchant server') handler.add_argument('-P', '--port', type=int, default=config_info.port, help='the port for the enchant server') handler.add_argument('-u', '--username', default=config_info.username, help='the username to use') handler.add_argument('-p', '--password', default=config_info.password, help='the password to use') handler.run()
def main(): amo = AddonsService(login_prompter=login_prompter_impl) cookiedefault = os.path.expanduser('~/.amo_cookie') def load_context(args): amo.session.load(args.cookies) amo.session.timeout = args.timeout return amo handler = ArgumentHandler(use_subcommand_help=True) handler.add_argument('-c', '--cookies', default=cookiedefault, help='the file to save the session cookies to') handler.add_argument('--timeout', type=int, default=None, help='timeout for http requests') handler.set_logging_argument('-d', '--debug', default_level=logging.WARNING, config_fxn=init_logging) try: handler.run(sys.argv[1:], context_fxn=load_context) amo.persist() except KeyboardInterrupt: pass
def main(): amo = AddonsService(login_prompter=login_prompter_impl) cookiedefault = os.path.expanduser('~/.amo_cookie') def load_context(args): amo.session.load(args.cookies) return amo handler = ArgumentHandler() handler.add_argument('-c', '--cookies', default=cookiedefault, help='the file to save the session cookies to') handler.set_logging_argument('-d', '--debug', default_level=logging.WARNING, config_fxn=init_logging) handler.run(sys.argv[1:], context_fxn=load_context) amo.persist()
def main(): amo = AddonsService(login_prompter=login_prompter_impl) cookiedefault = os.path.expanduser('~/.amo_cookie') def load_context(args): amo.session.load(args.cookies) return amo handler = ArgumentHandler() handler.add_argument('-c', '--cookies', default=cookiedefault, help='the file to save the session cookies to') handler.set_logging_argument('-d', '--debug', default_level=logging.WARNING, config_fxn=init_logging) handler.run(sys.argv[1:], context_fxn=load_context) amo.persist()