bin/resend_borg_error.py

25 lines
540 B
Python
Raw Normal View History

2024-11-27 13:17:52 -06:00
# /// script
# dependencies = [
# "resend",
# ]
# ///
2024-09-07 15:39:46 -05:00
2024-09-07 16:07:20 -05:00
import subprocess
2024-11-27 13:17:52 -06:00
from pathlib import Path
import resend
2024-09-07 15:39:46 -05:00
2024-11-27 13:17:52 -06:00
resend.api_key = (
Path("/usr/local/etc/resend_api_key.txt").read_text().strip("\n")
)
2024-09-07 15:39:46 -05:00
params: resend.Emails.SendParams = {
2024-11-27 13:17:52 -06:00
"from": "Borgmatic <admin@hyperreal.coffee>",
"to": ["hyperreal@moonshadow.dev"],
2024-09-08 20:32:21 -05:00
"subject": "[moonshadow] Error running Borgmatic",
"text": "There was an error running your Borgmatic backup on moonshadow. Please investigate.",
2024-09-07 15:39:46 -05:00
}
email = resend.Emails.send(params)
print(email)