This commit is contained in:
cilame 2022-04-11 19:50:33 +08:00
parent a75b81ab1c
commit 955d806051

View File

@ -91,7 +91,7 @@ import json
import traceback import traceback
import threading import threading
from urllib.parse import unquote from urllib.parse import unquote
from flask import Flask, request from flask import Flask, request, jsonify
app = Flask(__name__) app = Flask(__name__)
@app.route('/getinfo', methods=['GET']) @app.route('/getinfo', methods=['GET'])
def main(): def main():
@ -101,7 +101,7 @@ def main():
async with websockets.connect("ws://127.0.0.1:{}/getinfo".format(WSS_SERVER_PORT)) as websocket: async with websockets.connect("ws://127.0.0.1:{}/getinfo".format(WSS_SERVER_PORT)) as websocket:
await websocket.send(info) await websocket.send(info)
return await websocket.recv() return await websocket.recv()
return asyncio.run(clientRun()) return jsonify({"message": asyncio.run(clientRun())})
except: except:
traceback.print_exc() traceback.print_exc()
return "启动接口失败." return "启动接口失败."