#!/usr/bin/python3
import json, subprocess, time, os
TOKEN = open(os.path.expanduser('~/.secrets/leakradar_paid_token.txt')).read().strip()
API = "https://api.leakradar.io"; PROXY = ["--socks5-hostname", "127.0.0.1:40000"]
def curl(path, method="GET", data=None):
    args = ["curl","-s","-m","90",*PROXY,"-H","Authorization: "+TOKEN]
    if method=="POST": args += ["-X","POST","-H","Content-Type: application/json","-d",data or "{}"]
    args += [API+path]
    r = subprocess.run(args, capture_output=True, text=True)
    try: return json.loads(r.stdout)
    except Exception: return {"raw": r.stdout[:500]}
# sample customers list
r = curl("/search/domain/tradingview.com/customers?page=1&page_size=5")
print("TRADINGVIEW SAMPLE:"); print(json.dumps(r, indent=1)[:2500])
# account info
for ep in ["/profile", "/user", "/credits", "/me"]:
    r = curl(ep)
    if isinstance(r, dict) and r.get('raw') is None:
        print(ep, "->", json.dumps(r)[:300])
