def array_to_dict_response(self, params): """ Convert the array element recieved by SOAP in a Dictionary . Param: params -- The array """ dict = {} rs = SOAP.simplify(params) if rs: for test in rs['item']: dict[test['key']] = test['value'] return dict else: return False
def array_to_dict_response(self, params): """ Convert the array element recieved by SOAP in a Dictionary . Param: params -- The array """ dictionary = {} rs = SOAP.simplify(params) if isinstance(rs, list): for test in rs: dictionary[test['item']['key']] = test['item']['value'] return dictionary elif isinstance(rs, dict): for test in rs['item']: dictionary[test['key']] = test['value'] return dictionary else: return False