1.python3中digest()和hexdigest()区别。
hash.digest()
返回摘要,作为二进制数据字符串值。hash.hexdigest()
返回摘要,作为十六进制数据字符串值
2.获取cookies实现免密登录,r = requests.get(url,headers=header) cookie = requests.utils.dict_from_cookiesjar(r.cookies)
3.在jmeter中使用BeanShell对字符串进行sha256加密
import org.apache.commons.codec.digest.DigestUtils;
String password = "111111";
String pwd_sha256 = DigestUtils.sha256Hex(password);
#结果是大写:String pwd_sha256 = DigestUtils.sha256Hex(password).toUpperCase();
vars.put("pwd-sha256", pwd_sha256);
4.data={},import json json_str=json.dumps() #将data转换成json格式 dict_str=json.loads(json_str)#将json串转换成字典。这时候可以通过dict.keys()取出或者操作字典数据了