需要检查请求的响应时间,
def showNew(url,params):
headers = {'content-type': 'application/json'}
ret = requests.post(url, data=json.dumps(params), headers=headers, cookies=cookies)
# 获取响应的时间elapsed
d1 = ret.elapsed.total_seconds()
# d1 = json.loads(ret.elapsed.total_seconds())
print(d1)
调用方法:elapsed.total_seconds()
total_seconds()总时长,单位秒