dotb_ai-platform/scripts/fixture_webhook.py
hungtran24 8082a9f968 chore: streamline local development and fixture tooling
Run backend and web with a shared configurable port, add local webhook and secret-generation helpers with tests, and document current app-auth and fixture workflows.
2026-10-02 10:58:09 +07:00

27 lines
858 B
Python

"""Local fixture webhook receiver: ACK only, no signature or integration verification."""
from http.server import BaseHTTPRequestHandler, HTTPServer
class FixtureWebhookHandler(BaseHTTPRequestHandler):
def do_POST(self) -> None:
if self.path != "/notifications":
self.send_error(404)
return
try:
length = int(self.headers.get("Content-Length", "0"))
except ValueError:
self.send_error(400)
return
if not 0 <= length <= 8192:
self.send_error(413)
return
self.rfile.read(length)
self.send_response(202)
self.end_headers()
if __name__ == "__main__":
print("Fixture webhook receiver: http://127.0.0.1:9001/notifications", flush=True)
HTTPServer(("127.0.0.1", 9001), FixtureWebhookHandler).serve_forever()