Fix: r.json() returns string, check isinstance, v1.0.21

This commit is contained in:
2026-07-24 09:23:07 +04:00
parent 6f0b9c876f
commit 2ae1f5dd66
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -23,10 +23,11 @@ class HttpClient:
raise Exception(f"{r.status_code} {r.reason}: {r.text[:200]}") raise Exception(f"{r.status_code} {r.reason}: {r.text[:200]}")
result = {} result = {}
try: try:
result = r.json() parsed = r.json()
if isinstance(parsed, dict):
result = parsed
except Exception: except Exception:
pass pass
# instanceUid приходит в Location (для create)
loc = r.headers.get("Location", "") loc = r.headers.get("Location", "")
if loc: if loc:
result["_location"] = loc result["_location"] = loc
+1 -1
View File
@@ -6,7 +6,7 @@ from routes.main import bp as main_bp
from routes.api import bp as api_bp from routes.api import bp as api_bp
from routes.api_test import bp as api_test_bp from routes.api_test import bp as api_test_bp
VERSION = "1.0.20" VERSION = "1.0.21"
app = Flask(__name__, template_folder="templates", static_folder="static") app = Flask(__name__, template_folder="templates", static_folder="static")
app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-dev.ngcloud.ru/api/v1/svc") app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-dev.ngcloud.ru/api/v1/svc")