| Total Complexity | 2 |
| Total Lines | 14 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import json |
||
| 9 | class OpenIncident(VictorOpsAction): |
||
| 10 | def run(self, severity, entity, message=None, notify_group=None): |
||
| 11 | prms = { |
||
| 12 | "message_type": severity, |
||
| 13 | "timestamp": int(time.time()), |
||
| 14 | "entity_id": entity, |
||
| 15 | "state_message": message} |
||
| 16 | post_data = json.dumps(prms) |
||
| 17 | if notify_group is not None: |
||
| 18 | url = self.url.replace(self.url.split("/")[-1], notify_group) |
||
| 19 | else: |
||
| 20 | url = self.url |
||
| 21 | requests.post(url, post_data) |
||
| 22 | return True |
||
| 23 |