I have no experience with python, just started looking into this week:
messages = []
msg_list = ticket.message
for message in msg_list:
for item in msg_list:
item_json = json.loads(message.body)
tmp_item.date = item_json['date']
tmp_item.time = item_json['time']
tmp_item.author = item_json['author']
tmp_item.location = item_json['location']
tmp_item.message = item_json['message']
msg_list.append(tmp_item)
return {"payload": msg_list}
Is there a way I can check if the item_json(message.body) does not have the following props, "date", "time", "author", "location" and "message" to simply avoid it,and do not append to msg_list??
So basically I just want to append if it meets that criteria, example would be
if item_json['date'] and item_json['time'] and item_json['author'].... :