def convert_to_dict(src): """ converts the content of source xml file to the a dict """ with open(src) as fxml: xml = fxml.read() try: return parse_to_dict(xml) except: return ConversionFailureError()
def send_response(response): parsed_resp = parse_to_dict(response) if is_successful(parsed_resp): return parsed_resp else: raise KempTechApiException(get_error_msg(parsed_resp))