Ai
1 Star 0 Fork 0

李帅/diffy.example.backend

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
old_code_copy_5003.py 907 Bytes
一键复制 编辑 原始数据 按行查看 历史
zhenwei.li 提交于 2020-05-22 14:34 +08:00 . test
# -*- coding: utf-8 -*-
import random
from flask import Flask, request, make_response, jsonify
from flask_cors import *
import json
app = Flask(__name__)
CORS(app, supports_credentials=True)
app.debug = True # 自动重启
# 这个是老代码的副本。和老代码完全一致
@app.route('/getMsg',methods=["GET","POST"])
def getMsg():
if request.method == 'POST':
username = request.json['username']
password= request.json['password']
# 假定用户id是密码反转+用户名反转得出来的
num = random.randint(1, 100)
datat = {
"userid": username[::-1]+password[::-1],
"random": num
}
return json.dumps(datat)
elif request.method == 'GET':
datat = {
"userid": 0,
}
return json.dumps(datat)
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5003, debug=True)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/li_shuai520/diffy.example.backend.git
git@gitee.com:li_shuai520/diffy.example.backend.git
li_shuai520
diffy.example.backend
diffy.example.backend
master

搜索帮助