import traceback
import demistomock as demisto
from CommonServerPython import *
def get_html_representation(dbotscore) -> str:
html = "
0
Unknown
"
if dbotscore == 1:
html = "1
Good
"
elif dbotscore == 2:
html = "2
Suspicious
"
elif dbotscore == 3:
html = "3
Bad
"
return html
def main() -> None:
try:
dbotscore = demisto.incidents()[0].get("CustomFields").get("chronicledbotscore", 0)
html = get_html_representation(dbotscore)
demisto.results({"Type": 1, "ContentsFormat": formats["html"], "Contents": html})
except Exception as e:
demisto.error(traceback.format_exc())
return_error(f"Could not load widget:\n{e}")
# python2 uses __builtin__ python3 uses builtins
if __name__ == "__builtin__" or __name__ == "builtins":
main()