v1.0.85: create_client(token) everywhere — single entry point stand detection; {{ stand }} in UI
This commit is contained in:
+7
-1
@@ -2,6 +2,7 @@ import threading
|
||||
|
||||
from flask import Blueprint, current_app, jsonify, request
|
||||
|
||||
from api.http_client import create_client
|
||||
from runner import run_tests, get_status, load_config, save_config
|
||||
|
||||
bp = Blueprint("api", __name__)
|
||||
@@ -9,9 +10,14 @@ bp = Blueprint("api", __name__)
|
||||
|
||||
@bp.route("/api/run", methods=["POST"])
|
||||
def api_run():
|
||||
token = current_app.config["NUBES_API_TOKEN"]
|
||||
result = create_client(token, current_app.config["NUBES_API_ENDPOINT"])
|
||||
if not result:
|
||||
return jsonify({"error": "Не удалось определить стенд"}), 500
|
||||
client, endpoint = result
|
||||
t = threading.Thread(
|
||||
target=run_tests,
|
||||
args=(current_app.config["NUBES_API_ENDPOINT"], current_app.config["NUBES_API_TOKEN"]),
|
||||
args=(endpoint, token),
|
||||
daemon=True,
|
||||
)
|
||||
t.start()
|
||||
|
||||
Reference in New Issue
Block a user