Fix: r.json() returns string, check isinstance, v1.0.21
This commit is contained in:
@@ -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
@@ -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")
|
||||||
|
|||||||
Reference in New Issue
Block a user