v1.0.54: fix 4 audit bugs — _client auto-detect, _find_uid by key, tracker_add before params, flock LOCK_NB

This commit is contained in:
2026-07-27 10:18:49 +04:00
parent f546f41f21
commit 338c080254
6 changed files with 126 additions and 33 deletions
+18
View File
@@ -1,5 +1,23 @@
import requests
STANDS = [
"https://lk-api-gateway-dev.ngcloud.ru/api/v1/svc",
"https://lk-api-gateway-test.ngcloud.ru/api/v1/svc",
]
def detect_endpoint(token):
"""Пробуем токен против dev и test стендов, возвращаем рабочий URL."""
for ep in STANDS:
try:
c = HttpClient(ep, token)
data = c.get("/instances", params={"pageSize": 1, "page": 1})
if data.get("results") is not None:
return ep
except Exception:
continue
return None
class HttpClient:
def __init__(self, endpoint, token):