Files
jfa-go/scripts/scrape-custom-content-schema.py
Harvey Tindall 60dbfa2d1e messages: custom content described in customcontent.go, message tests
customcontent.go constains a structure with all the custom content,
methods for getting display names, subjects, etc., and a list of
variables, conditionals, and placeholder values. Tests for constructX
methods included in email_test.go, and all jfa-go tests can be run with
make INTERNAL=off test.
2025-08-30 14:21:26 +01:00

17 lines
767 B
Python

# Quick script to scrape custom content names, variables and conditionals. The decision to generate vars and conds dynamically from the included plaintext emails, then bodge extra variables on top was stupid, and is only done -once- before getting stored in the DB indefinitely, meaning new variables can't easily be added. Output of this will be coalesced into a predefined list included with the software.
import requests, json
content = requests.get("http://localhost:8056/config/emails?lang=en-gb&filter=user").json()
out = {}
for key in content:
resp = requests.get("http://localhost:8056/config/emails/"+key)
out[key] = resp.json()
del out[key]["html"]
del out[key]["plaintext"]
del out[key]["content"]
print(json.dumps(out, indent=4))