7 后端开发 - jmeter测试
1 注册
- 请求
![]()
- 数据库

2 登录
- 请求:返回token

3 博客列表
- 代码:@jwt_required() 表示需要进行token验证
# 博客列表 @app.route(rule='/blog/list', methods=['GET']) @jwt_required() def blog_list(): # 这个是为了理解 current_user = get_jwt_identity() print(current_user) # print(type(current_user)) # 表查询 blogs = su.exec_sql("select * from blog") # print(blogs) # 返回信息 respone_json_data['code'] = 1 respone_json_data['data'] = blogs respone_json_data['msg'] = 'get blogs success' return json.dumps(respone_json_data)
- 请求


4 新增博客
- 代码:@jwt_required() 表示需要进行token验证
# 新增博客 @app.route(rule='/blog/add', methods=['POST']) @jwt_required() def blog_add(): # 获取请求数据 req_json_data = json.loads(request.get_data()) title = req_json_data['title'] content = req_json_data['content'] # 新增博客 result = su.exec_sql("insert into blog (title, content) values('{}','{}')" .format(title, content)) su.commit() # 返回信息 respone_json_data['code'] = 1 respone_json_data['data'] = result respone_json_data['msg'] = 'add blog success' return json.dumps(respone_json_data)
- 请求



浙公网安备 33010602011771号