in cvm-attestation/src/ImdsClient.py [0:0]
def get_td_quote(self, encoded_report):
"""
Get the TD quote from the IMDS endpoint.
Parameters:
encoded_report: The encoded report to be sent in the request body.
Returns:
The TD quote received from the IMDS endpoint.
"""
headers = {'Content-Type': 'application/json'}
request_body = json.dumps({"report": encoded_report})
response = self._send_request_with_retries(
method='post',
url=TD_QUOTE_ENDPOINT,
headers=headers,
data=request_body,
exception_class=TDQuoteException
)
try:
evidence_json = response.json()
self.log.info("Received td quote successfully")
return evidence_json['quote']
except json.JSONDecodeError as e:
self.log.error("Failed to decode TD quote JSON", exc_info=True)
raise TDQuoteException(f"JSON decoding error: {e}") from e