# 导包
from flask import Flask,request,jsonify,json
# 创建一个服务
app=Flask(__name__)
# post请求,路径:/query
@app.route('/query', methods=['post'])
def login():
key_token=request.values.get('token')
if key_token=='123abc':
result={'code':200,'message':'恭喜你登陆成功'}
return json.dumps(result,ensure_ascii=False),200
else:
result={'code':9999,'token':'为空或不正确!'}
return json.dumps(result,ensure_ascii=False),403
# 运行服务
if __name__=='__main__':
app.run(threaded=True,port=9080,host='localhost')