mirror of
https://github.com/WhaleFell/SMSBoom.git
synced 2026-04-09 13:39:10 +08:00
🐞 fix: 修复webui的一个bug
This commit is contained in:
2
Pipfile
2
Pipfile
@@ -18,4 +18,4 @@ flask-babelex = "*"
|
||||
[dev-packages]
|
||||
|
||||
[requires]
|
||||
python_version = "3.6"
|
||||
python_version = "3.8"
|
||||
|
||||
@@ -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}"})
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user