MCPcopy Create free account
hub / github.com/AzureAD/microsoft-authentication-library-for-python / parse_error

Function parse_error

msal/wstrust_response.py:51–56  ·  view source on GitHub ↗
(body)

Source from the content-addressed store, hash-verified

49 raise RuntimeError("WsTrust server returned error in RSTR: %s" % (error or body))
50
51def parse_error(body): # Returns error as a dict. See unit test case for an example.
52 dom = ET.fromstring(body)
53 reason_text_node = dom.find('s:Body/s:Fault/s:Reason/s:Text', Mex.NS)
54 subcode_value_node = dom.find('s:Body/s:Fault/s:Code/s:Subcode/s:Value', Mex.NS)
55 if reason_text_node is not None or subcode_value_node is not None:
56 return {"reason": reason_text_node.text, "code": subcode_value_node.text}
57
58def findall_content(xml_string, tag):
59 """

Callers 2

parse_responseFunction · 0.85
test_parse_errorMethod · 0.85

Calls 1

findMethod · 0.80

Tested by 1

test_parse_errorMethod · 0.68