add refresh_balances/diag, tokens_guard (single UPDATE), priority notes; 70 accounts live

This commit is contained in:
ENI
2026-11-14 15:09:25 +02:00
parent 93bdd85459
commit 77d0cd6feb
21 changed files with 841 additions and 2 deletions
+37
View File
@@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
"""Диагностика нулевых балансов: ленивая выдача Theos или отказ."""
import json
import sys
import dpcode as D
recs = [r for r in D.read_bank() if r.get("stage") == "ok"]
zero = []
for r in recs:
t = r.get("theos") or {}
try:
if float(t.get("balance") or 0) == 0:
zero.append(r)
except Exception:
pass
print("zero accounts:", len(zero))
for r in zero[:3]:
email = r["email"]
print("==", email)
for label, machine in [
("salt_per_email", D.machine_header(salt=email)),
("real_machine", D.machine_header()),
("random", D.machine_header(raw="seed-" + email.lower())),
]:
s = D.session_from(r)
st, body = D.theos(s, machine)
bal = (body or {}).get("balance") if isinstance(body, dict) else None
en = (body or {}).get("enabled") if isinstance(body, dict) else None
print(f" {label:16s} theos={st} enabled={en} bal={bal} {str(body)[:90] if st != 200 else ''}", flush=True)
if st == 200:
rr = D.chat(s, machine, "glm-5.3-flash", [{"role": "user", "content": "say ok"}], 24)
ok = rr.status_code
st2, body2 = D.theos(s, machine)
bal2 = (body2 or {}).get("balance") if isinstance(body2, dict) else None
print(f" after chat[{ok}] -> theos={st2} bal={bal2}", flush=True)
break