python运行接口报错,jmeter运行正常
import timeimport 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 ", '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}}
http://quan.51testing.com/pcQuan/chat/2864 参考下这个 JMeter可以运行成功说明接口没问题啊,检查下Python代码呢 参考下这个链接https://blog.csdn.net/qq_40999727/article/details/103200939 检查跑错信息 json有问题吧
页:
[1]