MCPcopy Create free account
hub / github.com/bdring/FluidNC / handle_webhook

Method handle_webhook

examples/http_command/http_command_server.py:249–268  ·  view source on GitHub ↗

Handle webhook POST requests

(self, path, body)

Source from the content-addressed store, hash-verified

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"""

Callers 1

do_POSTMethod · 0.95

Calls 1

send_json_responseMethod · 0.95

Tested by

no test coverage detected