def _trigger(self, check, incident_key, priority):
        headers = {'Content-Type': 'application/json'}
        data = json.dumps({'service_key': self.service_keys[priority],
                           'incident_key': incident_key,
                           'event_type': 'trigger',
                           'description': '%s on %s is DOWN' %
                           (check['check'], check['hostname']),
                           'details': check})
        try:
            req = urllib2.Request(self.url, data, headers)
            response = urllib2.urlopen(req, timeout=10)
            result = json.loads(response.read())
            response.close()
            if 'status' in result:
                if result['status'] == 'success':
                    self.logger.info('Triggered pagerduty event: %s' % result)
                    return True
                else:
                    self.logger.info(
                        'Failed to trigger pagerduty event: %s' % result)
                    return False
            else:
                self.logger.info(
                    'Failed to trigger pagerduty event: %s' % result)
                return False
        except Exception:
            self.logger.exception('Error triggering pagerduty event.')
            return False
dataset/ETHPy150Open pandemicsyn/stalker/stalkeragent/stalkeragent/stalker_notifications.py/PagerDuty._trigger/original