def get_request_data(self,row): '''获取请求数据 ''' operate_json = OperateJson() col = self.global_val.request_data request_key = self.excel.get_cell(row,col) request_data = None if request_key != '': request_data = operate_json.get_data(request_key) for key in request_data: if not isinstance(request_data[key],str): # 如果value不是str类型 request_data[key] = json.dumps(request_data[key]) # 将value转换成str类型 return request_data
def get_case_header(self, row, url, request_data): """ :param row: :param url: :param request_data: :return: 若header为write,则写入cookie,返回None,若为yes则获取cookie,若为no则返回none """ header_col = get_header() header = self.excel.get_cell_value(row, header_col) if header == "write": op_header = OperateHeader() op_header.write_cookies(url=url, data=request_data) return None elif header == "yes": op_json = OperateJson(r"../dataconfigure/cookie.json") value = op_json.get_data("sessionid") cookie = {"sessionid": value} return cookie else: return None