diff --git a/infrastructure/abri/abri_client.py b/infrastructure/abri/abri_client.py index 2579ba341..a5c9ffaef 100644 --- a/infrastructure/abri/abri_client.py +++ b/infrastructure/abri/abri_client.py @@ -1,6 +1,8 @@ +import xml.etree.ElementTree as ET + import requests -from domain.abri.models import LogJobRequest, LogJobResult +from domain.abri.models import JobLogged, LogJobRequest, LogJobResult from infrastructure.abri.config import AbriConfig @@ -10,4 +12,12 @@ class AbriClient: self._session = requests.Session() def log_job(self, request: LogJobRequest) -> LogJobResult: - raise NotImplementedError + response = self._session.post(self._config.endpoint_url, data=b"") + root = ET.fromstring(response.content) + job_logged = root.find("Jobs/Job_logged") + if job_logged is None: + raise ValueError("Job_logged element missing from relay response") + return JobLogged( + job_no=job_logged.attrib["job_no"], + logged_info=job_logged.attrib["logged_info"], + )