首页 > 其他 > 详细

flask如何写一个接口

时间:2021-05-21 18:10:05      阅读:11      评论:0      收藏:0      [点我收藏+]
 1 # -*- coding: utf-8 -*-
 2 
 3 # 导入一个蓝图
 4 from flask import Blueprint
 5 from graphics.utils import http_content_util
 6 from graphics.db_utils import car as db_util
 7 
 8 car_bp = Blueprint(car, __name__)
 9 
10 @car_bp.route(/new, methods=[POST, GET])
11 def new_car():
12     car_id, model, plate_number = http_content_util.get_param_get_or_post("car_id", "model", "plate_number")
13     try:
14         db_util.insert_car(car_id, model, plate_number)
15         return http_content_util.response_ok()
16     except Exception as e:
17         return http_content_util.response_error(str(e))

 

flask如何写一个接口

原文:https://www.cnblogs.com/chaojiyingxiong/p/14794218.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!