"""Seed the spliteasy backend with 3 users and 1 group.""" import sys import requests BASE = "http://127.0.0.1:5001" def post(path, payload): r = requests.post(f"{BASE}{path}", json=payload, timeout=10) if r.status_code >= 400: print(f"[seed] POST {path} -> {r.status_code} {r.text}", file=sys.stderr) sys.exit(1) return r.json() def main(): users = [ {"name": "Alice", "email": "alice@x.io"}, {"name": "Bob", "email": "bob@x.io"}, {"name": "Carol", "email": "carol@x.io"}, ] user_ids = [post("/api/users", u)["id"] for u in users] group = post("/api/groups", {"name": "Tahoe Trip", "member_ids": user_ids}) print(f"[seed] created group id={group['id']} with members={user_ids}") if __name__ == "__main__": main()