import time
import random
import hashlib
import requests
import json
#1.生成5位随机数
phone=random.randint(10000,99999)
#2.生成13位数字的时间戳
timeStamp=int(round(time.time()*1000))
print(timeStamp)
optCode="testfan"
#3.随机数和时间戳拼接
t=str(phone+timeStamp)
#4.sign=phoneNum+timeStamp+optCode
sign=t+optCode
#4.实例化一个md5对象
md5=hashlib.md5()
python运行后返回结果:
{'timestamp': '2020-05-10T15:10:02.512+0000', 'status': 400, 'error': 'Bad Request', 'message': "JSON parse error: Unrecognized token 'phoneNum': was expecting ('true', 'false' or 'null'); nested exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'phoneNum': was expecting ('true', 'false' or 'null')\n at [Source: (PushbackInputStream); line: 1, column: 10]", 'path': '/pinter/com/userInfo'}
jmeter运行后返回的正常结果:
{"code":"0","message":"success","data":{"id":2337,"userName":"性能测试","password":null,"age":80,"gender":1,"phoneNum":"39508","email":"beihe@testfan.com","address":"北京市昌平区科星西路106号院(国风美唐花园综合楼)3号楼1111","createTime":null,"updateTime":null}}