From 91fa93f2ccee92238a29cd3fb47f80daad955edf Mon Sep 17 00:00:00 2001 From: Jeffrey Serio Date: Wed, 27 Nov 2024 13:17:52 -0600 Subject: [PATCH] Fix resend_borg_error.py --- resend_borg_error.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/resend_borg_error.py b/resend_borg_error.py index a2edfb5..cf89e49 100755 --- a/resend_borg_error.py +++ b/resend_borg_error.py @@ -1,18 +1,21 @@ -#!/usr/bin/env nix-shell -#! nix-shell -i python3 --packages python3 python312Packages.resend +# /// script +# dependencies = [ +# "resend", +# ] +# /// + +import subprocess +from pathlib import Path import resend -import subprocess -resend.api_key = subprocess.run( - ["kwallet-query", "-r", "resend_api_key", "default", "-f", "Passwords"], - capture_output=True, - text=True, -).stdout.strip("\n") +resend.api_key = ( + Path("/usr/local/etc/resend_api_key.txt").read_text().strip("\n") +) params: resend.Emails.SendParams = { - "from": "Borgmatic ", - "to": ["hyperreal@fedoraproject.org"], + "from": "Borgmatic ", + "to": ["hyperreal@moonshadow.dev"], "subject": "[moonshadow] Error running Borgmatic", "text": "There was an error running your Borgmatic backup on moonshadow. Please investigate.", }