Files
keyhunter-parser/tmp/validate_gitlab_new.py

24 lines
1007 B
Python

"""Validate gitlab_public NEW DashScope keys via dashscope_hunt.probe_dashscope."""
import sqlite3, sys
sys.path.insert(0, r"C:\Users\User\Desktop\keyhunter")
from dashscope_hunt import probe_dashscope
DB = r"C:\Users\User\Desktop\keyhunter\data\keys.db"
db = sqlite3.connect(DB, timeout=30)
rows = db.execute("SELECT hash, val FROM keys WHERE status='NEW' AND prov='gitlab_public'").fetchall()
print(f"{len(rows)} NEW gitlab_public keys")
for h, k in rows:
st, info = probe_dashscope(k)
if st == "WORKING":
new, note = "WORKING", (info or "")[:200]
elif st in ("net", "endpoint_error"):
new, note = "ERR", "net"
elif st in ("arrearage", "free_tier", "throttled", "no_model", "UNVERIFIED_AUTHBLIND"):
new, note = "LIMITED", st + (f" {info}" if info else "")
else: # reject
new, note = "DEAD", st
db.execute("UPDATE keys SET status=?, plan=? WHERE hash=?", (new, note[:200], h))
db.commit()
print(f"{k[:14]}… -> {new} ({note})")
db.close()