37 lines
1.4 KiB
Python
37 lines
1.4 KiB
Python
# -*- 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 |