in gnm_deliverables/management/commands/check_vs_notification.py [0:0]
def create_new_notification(self):
triggerdoc = ET.Element("trigger", attrib={"xmlns": "http://xml.vidispine.com/schema/vidispine"})
trigger = VSTriggerEntry(triggerdoc)
trigger.trigger_class = "job"
trigger.action = "stop"
actiondoc = ET.Element("http", attrib={"xmlns":"http://xml.vidispine.com/schema/vidispine"})
action = HttpNotification(actiondoc)
action.url = settings.VS_CALLBACK_ROOT + self.our_notification_url
action.method = "POST"
action.contentType = "application/json"
action.retry = 5
action.synchronous = False
action.timeout=10
notif = VSNotification(url=settings.VIDISPINE_URL,user=settings.VIDISPINE_USER, passwd=settings.VIDISPINE_PASSWORD)
notif.add_action(action)
notif.trigger = trigger
notif.objectclass = "job"
print(notif.as_xml())
print("Creating new notification to {}".format(action.url))
notif.save()