aboutsummaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
authorChristian Cleberg <hello@cleberg.net>2025-06-20 13:55:54 -0500
committerChristian Cleberg <hello@cleberg.net>2025-06-20 13:55:54 -0500
commit785f42901f34aaf356f316c691e3f56138c8608d (patch)
tree5b8f7a6e33a6af410e511137fdd51b6fa60d0f83 /main.py
downloadaws-summary-report-785f42901f34aaf356f316c691e3f56138c8608d.tar.gz
aws-summary-report-785f42901f34aaf356f316c691e3f56138c8608d.tar.bz2
aws-summary-report-785f42901f34aaf356f316c691e3f56138c8608d.zip
initial commit
Diffstat (limited to 'main.py')
-rw-r--r--main.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/main.py b/main.py
new file mode 100644
index 0000000..7e82673
--- /dev/null
+++ b/main.py
@@ -0,0 +1,38 @@
+import toml
+from utils import send_email
+import importlib
+
+
+def load_sections(section_names, config):
+ report_parts = []
+
+ for name in section_names:
+ try:
+ mod = importlib.import_module(f"sections.{name}")
+ section_text = mod.get_section(config)
+ report_parts.append(section_text)
+ except Exception as e:
+ report_parts.append(f"[ERROR loading section '{name}']: {e}")
+
+ return "\n\n".join(report_parts)
+
+
+def main():
+ config = toml.load("config.toml")
+ sections = config["report"]["sections"]
+
+ body = load_sections(sections, config)
+
+ send_email(
+ smtp_config=config["email"],
+ subject="AWS Daily Report",
+ body=body,
+ recipients=config["recipients"]["emails"],
+ )
+
+ # DEBUG
+ # print(body)
+
+
+if __name__ == "__main__":
+ main()