def __get_alert_body__(self, rule, device_list, list_of_results): components_conditions = ConditionsParser(rule=rule, list_of_results=list_of_results).build_conditions() device_id = device_list[0] return { "msgType": "alertsPush", "data": [ { "accountId": str(rule['accountId']), "ruleId": str(rule['externalId']), "deviceId": device_id, "timestamp": int(TimestampFormatter.convert_ts_to_non_scientific_ms(time.time())), 'conditions': [ { 'components': components_conditions } ] } ] }
def format_end_date(db_timestamp): if db_timestamp is None: return 'z' return TimestampFormatter.convert_ts_to_non_scientific_ms(db_timestamp)