bin/resend_borg_error.py

22 lines
633 B
Python
Raw Normal View History

2024-09-07 23:07:20 +02:00
#!/usr/bin/env nix-shell
#! nix-shell -i python3 --packages python3 python312Packages.resend
2024-09-07 22:39:46 +02:00
import resend
2024-09-07 23:07:20 +02:00
import subprocess
2024-09-07 22:39:46 +02:00
2024-09-07 23:07:20 +02:00
resend.api_key = subprocess.run(
["kwallet-query", "-r", "resend_api_key", "default", "-f", "Passwords"],
capture_output=True,
text=True,
).stdout.strip("\n")
2024-09-07 22:39:46 +02:00
params: resend.Emails.SendParams = {
"from": "Borgmatic <onboarding@resend.dev>",
"to": ["hyperreal@fedoraproject.org"],
2024-09-09 03:32:21 +02:00
"subject": "[moonshadow] Error running Borgmatic",
"text": "There was an error running your Borgmatic backup on moonshadow. Please investigate.",
2024-09-07 22:39:46 +02:00
}
email = resend.Emails.send(params)
print(email)