Refactor rate limiter and datetime formatting

This commit is contained in:
2026-01-22 02:24:03 +01:00
parent f297a8d740
commit 04114ab659
8 changed files with 133 additions and 135 deletions

View File

@@ -2,6 +2,8 @@
import logging
import smtplib
from . import datetime_str
from email.mime.text import MIMEText
@@ -91,11 +93,11 @@ Hostname: {hostname}
"""
if last_ipv4:
ip = last_ipv4[0]
last_update = last_ipv4[1].strftime("%Y-%m-%d %H:%M:%S")
last_update = datetime_str(last_ipv4[1])
body += f"IPv4 address: {ip} (last update: {last_update})\n"
if last_ipv6:
ip = last_ipv6[0]
last_update = last_ipv6[1].strftime("%Y-%m-%d %H:%M:%S")
last_update = datetime_str(last_ipv6[1])
body += f"IPv6 address: {ip} (last update: {last_update})\n"
body += f"""Expiry TTL: {expiry_ttl} seconds