def post()

in atomresponder/views.py [0:0]


    def post(self, request):
        """
        Receives notifications from VS that a relevant import has taken place.
        Notification is set up in notification.py
        :param request: Django request object
        :return: Response
        """
        from rabbitmq.job_notification import JobNotification
        from lxml.etree import XMLSyntaxError, LxmlError
        from .notification import process_notification
        from .models import ImportJob

        logger.info("Received import notification")
        try:
            notification = JobNotification(request.body)
        except XMLSyntaxError:
            logger.error("Invalid XML document received from Vidispine: {0}".format(request.body))
            return Response({'status': 'Bad XML'}, status=400) #returning 400=> VS won't try again
        except LxmlError:
            logger.error("Unable to process Vidispine XML document, but syntax as ok")
            return Response({'status': 'Unable to process'}, status=500) #returning 500=> VS will try again (more likely problem is our side)

        try:
            process_notification(notification)
            return Response({'status': 'ok'})
        except ImportJob.DoesNotExist:
            logger.error("JobNotifyView: No import job found for {0}".format(notification))
            return Response({'status': 'notfound'}, status=200)