Rename project to Saiki and unify CLI

This commit is contained in:
Pawel
2026-05-26 18:09:26 -04:00
parent 8ee1f8de25
commit f38030238c
19 changed files with 1274 additions and 1326 deletions

19
saiki/ankiconnect.py Normal file
View File

@@ -0,0 +1,19 @@
"""Small AnkiConnect client."""
from __future__ import annotations
import requests
def anki_request(action: str, url: str = "http://localhost:8765", **params):
resp = requests.post(
url,
json={"action": action, "version": 6, "params": params},
timeout=30,
)
resp.raise_for_status()
data = resp.json()
if data.get("error") is not None:
raise RuntimeError(f"AnkiConnect error for {action}: {data['error']}")
return data["result"]