🐞 fix: 修复webui的一个bug

This commit is contained in:
AdminWhaleFall
2022-04-25 20:27:21 +08:00
parent 5385a9ffb5
commit 7186969099
3 changed files with 9 additions and 4 deletions

View File

@@ -18,4 +18,4 @@ flask-babelex = "*"
[dev-packages]
[requires]
python_version = "3.6"
python_version = "3.8"

View File

@@ -4,6 +4,8 @@ from . import main
import json
from ..model import Apis, API
from ..utils import test_resq
from .. import logger
import httpx
from flask_app import db
from flask import request, jsonify
@@ -20,6 +22,9 @@ def testapi():
api = API(**req)
resp = test_resq(api, phone=req.get('phone'))
print(resp.text)
return jsonify({"status": 0, "resp": resp.text})
return jsonify({"status": 0, "resp": f"{resp.text}"})
except httpx.HTTPError as why:
return jsonify({"status": 1, "resp": f"HTTP请求错误:{why}"})
except Exception as why:
return jsonify({"status": 1, "resp": why})
logger.exception(why)
return jsonify({"status": 1, "resp": f"其他错误:{why}"})

View File

@@ -74,7 +74,7 @@ def sqlite2json():
apis_.append(api.dict())
except:
pass
print(apis_)
# print(apis_)
with open(json_path, mode="w", encoding="utf8") as j:
try:
json.dump(apis_, j, ensure_ascii=False, sort_keys=False)