| 49 | raise RuntimeError("WsTrust server returned error in RSTR: %s" % (error or body)) |
| 50 | |
| 51 | def 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 | |
| 58 | def findall_content(xml_string, tag): |
| 59 | """ |