owenrusk.dev

errands

small jobs the runtime does for the studio.

git clone https://owenrusk.dev/errands.git

commit 1157f069ec09ecdcad5d8d7524eb5a4248e45910
parent 28fe2d0afa324d87310e2d4739d0f6c8d8ec08ae
author Owen Rusk <owen@papermothgames.com>
date   2025-09-09 15:40:08 -0500
tools: vault_login, for sites with no api

some of the bills only come as a login and a web page.
errands/tools.py+8-1
diff --git a/errands/tools.py b/errands/tools.py
index e85b535..7dfe6b9 100644
--- a/errands/tools.py
+++ b/errands/tools.py
@@ -2,7 +2,7 @@
 import json
 from typing import Callable
 
-from . import hosting, mail, posts
+from . import hosting, mail, posts, vault
 
 TOOLS: dict[str, Callable] = {}
 
@@ -45,6 +45,13 @@ def hosting_pay(amount: str) -> dict:
     return hosting.pay(hosting.dollars(amount))
 
 
+@tool
+def vault_login(name: str) -> dict:
+    item = vault.default().item(name)
+    login = item.get("login") or {}
+    return {"username": login.get("username"), "password": login.get("password"), "uris": [u["uri"] for u in login.get("uris") or []]}
+
+
 def call(line: str) -> str:
     try:
         request = json.loads(line)