Handle webhook POST requests
(self, path, body)
| 247 | self.send_json_response(response_data) |
| 248 | |
| 249 | def handle_webhook(self, path, body): |
| 250 | """Handle webhook POST requests""" |
| 251 | webhook_name = path.split('/')[-1] |
| 252 | |
| 253 | # Log the webhook call |
| 254 | print(f"Webhook '{webhook_name}' received") |
| 255 | if body: |
| 256 | try: |
| 257 | data = json.loads(body) |
| 258 | print(f" Data: {json.dumps(data, indent=2)}") |
| 259 | except: |
| 260 | print(f" Raw body: {body}") |
| 261 | |
| 262 | # Return success response |
| 263 | response_data = { |
| 264 | "status": "received", |
| 265 | "webhook": webhook_name, |
| 266 | "timestamp": datetime.now().isoformat() |
| 267 | } |
| 268 | self.send_json_response(response_data, 200) |
| 269 | |
| 270 | def handle_prometheus_push(self, body): |
| 271 | """Handle Prometheus pushgateway POST requests""" |
no test coverage detected