Model/infrastructure/abri/envelope.py
Daniel Roth 79ce9dc4b1 Abri log_job sends the spec's recorded LogJob envelope to the relay endpoint 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 14:24:57 +00:00

23 lines
769 B
Python

import xml.etree.ElementTree as ET
from typing import Sequence, Tuple
def serialise_relay_request(
request_type: str,
parameters: Sequence[Tuple[str, str]],
username: str,
password: str,
) -> bytes:
message = ET.Element("message")
header = ET.SubElement(message, "Header")
ET.SubElement(header, "Security", username=username, password=password)
body = ET.SubElement(message, "Body")
request = ET.SubElement(body, "Request", request_type=request_type)
for attribute, attribute_value in parameters:
ET.SubElement(
request,
"Parameters",
attribute=attribute,
attribute_value=attribute_value,
)
return ET.tostring(message, encoding="utf-8", xml_declaration=True)