Backup automatico script del 2026-07-19 07:00

This commit is contained in:
2026-07-19 07:00:03 +02:00
parent 927f0d4184
commit 4802b021fe
24 changed files with 686 additions and 213 deletions
+14
View File
@@ -1619,6 +1619,13 @@ def format_route_ice_report(df: pd.DataFrame, city1: str, city2: str) -> str:
return msg
def send_telegram_broadcast(token, message, debug_mode=False):
try:
from telegram_gate import telegram_alerts_enabled
except ImportError:
telegram_alerts_enabled = lambda: True # type: ignore
if not telegram_alerts_enabled():
return
base_url = f"https://api.telegram.org/bot{token}/sendMessage"
recipients = [ADMIN_CHAT_ID] if debug_mode else TELEGRAM_CHAT_IDS
@@ -1793,6 +1800,13 @@ def generate_route_ice_map(df: pd.DataFrame, city1: str, city2: str, output_path
def send_telegram_photo(token, photo_path, caption, debug_mode=False):
"""Invia foto via Telegram API."""
try:
from telegram_gate import telegram_alerts_enabled
except ImportError:
telegram_alerts_enabled = lambda: True # type: ignore
if not telegram_alerts_enabled():
return False
if not os.path.exists(photo_path):
return False