TuoniResult

class tuoni.TuoniResult(conf, c2)[source]

A class that provides data for a command result.

status

The status of the result.

Type:

str

error_message

The error message, if any, for the result.

Type:

str

received

The time, in string format, indicating when the result was received.

Type:

str

parts

A list of parts that make up the result.

Type:

list[TuoniResultPart]

get_files(download=False)[source]

Retrieve the file outputs from the result parts.

Returns:

A dictionary where keys are filenames and values are the file contents if download is True, otherwise a ResultPart object.

Return type:

dict

get_json()[source]

Retrieve the JSON output from the result parts.

Returns:

The JSON output if available, otherwise None.

Return type:

dict

get_text()[source]

Retrieve the text output from the result parts.

Returns:

The text output if available, otherwise None.

Return type:

str

is_file()[source]

Check if the result contains file output (result part where type is “file”).

Returns:

True if the result is a file output, False otherwise.

Return type:

bool

is_json()[source]

Check if the result contains JSON output (result part where name “json”).

Returns:

True if the result is a JSON output, False otherwise.

Return type:

bool

is_text()[source]

Check if the result contains typical text output (result part where name is “stdout”).

Returns:

True if the result is a text output, False otherwise.

Return type:

bool