v1.0.85: create_client(token) everywhere — single entry point stand detection; {{ stand }} in UI

This commit is contained in:
2026-07-27 17:26:09 +04:00
parent cd2e2349e2
commit 59e87cf50f
5 changed files with 36 additions and 8 deletions
+16
View File
@@ -19,6 +19,22 @@ def detect_endpoint(token):
return None
def stand_name(endpoint):
"""dev/test по URL стенда."""
for name in ("dev", "test"):
if name in (endpoint or ""):
return name
return "?"
def create_client(token, fallback_endpoint=None):
"""HttpClient с автоопределением стенда по токену."""
ep = detect_endpoint(token) or fallback_endpoint
if not ep:
return None
return HttpClient(ep, token), ep
class HttpClient:
def __init__(self, endpoint, token):
self._endpoint = endpoint.rstrip("/")