コード例 #1
0
def main(params, cmd_flags=None):
    global server

    args = cli_utils.get_valid_input(usage_stmt, operation_map, id="--modelid", argv=params, cmd_flags=cmd_flags)
    if args is not None:
        try:
            server = vapi.connect_to_server(cli_utils.host_name, cli_utils.token)
        except Exception as e:
            print("Error: Failed to setup server.", file=sys.stderr)
            logger.debug(e)
            return 1

        args.operation(args.op_params)
コード例 #2
0
def main(params, cmd_flags=None):
    global server

    args = cli_utils.get_valid_input(usage_stmt,
                                     operation_map,
                                     argv=params,
                                     cmd_flags=cmd_flags)
    if args is not None:
        # When requesting a token, we need to ignore any existing token info
        if args.cmd_params["<operation>"] == "token":
            cli_utils.token = ""
        try:
            server = vapi.connect_to_server(cli_utils.host_name,
                                            cli_utils.token)
        except Exception as e:
            print("Error: Failed to setup server.", file=sys.stderr)
            logger.debug(e)
            return 1

        args.operation(args.op_params)