pythons cripts

This commit is contained in:
Doar Mihai
2026-07-19 17:52:14 +03:00
parent 4bd21f3234
commit 6ca3750afb
7 changed files with 304 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
# Muninn API scripts
Thin Python CLI wrappers around this app's JSON API (see `../AI_API.md` for
the full API reference). Meant to be called directly by an AI agent on the
machine where this app is reachable — no setup beyond Python 3's standard
library (no third-party dependencies).
Default base URL: `http://localhost:8001`. Override with the
`MUNINN_API_URL` environment variable if the app runs elsewhere or on a
different port.
Every command prints the API's JSON response to stdout and exits `0` on
success. On an HTTP error or if the server can't be reached, it prints a
JSON error object to stderr and exits `1`.
## Sites (read-only)
```
python3 sites.py list [--name NAME]
python3 sites.py get SITE_ID
```
## Social Accounts (read-only)
```
python3 accounts.py list [--network NETWORK] [--type TYPE]
python3 accounts.py get ACCOUNT_ID
```
## Posts (full CRUD)
```
python3 posts.py list [--status STATUS] [--site-id ID] [--social-account-id ID] [--due]
python3 posts.py get POST_ID
python3 posts.py create --site-id ID --type TYPE --body BODY [--social-account-id ID] [--title TITLE] [--status STATUS] [--scheduled-at DATETIME]
python3 posts.py update POST_ID [--site-id ID] [--social-account-id ID] [--type TYPE] [--title TITLE] [--body BODY] [--status STATUS] [--scheduled-at DATETIME] [--published-url URL]
python3 posts.py delete POST_ID
```
`--due` finds posts that are `scheduled` and past their `scheduled_at` —
the query to run to discover what needs publishing right now.
Publishing itself is out of scope for these scripts (they only wrap the
HTTP API). See `../AI_API.md` for how to actually publish a post
(`php artisan posts:publish` for WordPress, the `sidecars/reddit-post`
sidecar for Reddit, or your own method for anything else — then report
back with `posts.py update POST_ID --status ...`).