Retrieve yesterday's data

This commit is contained in:
sfigato 2022-08-25 22:38:40 +02:00
parent 7470a3f7bb
commit f15c4cdcd9
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F
2 changed files with 15 additions and 5 deletions

View File

@ -1,6 +1,6 @@
# -*- encoding: utf-8 -*-
from contextlib import contextmanager
from datetime import datetime
from datetime import datetime, timedelta
from email import encoders
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
@ -58,7 +58,7 @@ class Notifier(object):
@retry_and_log(logger, RETRIES)
def send_result(self, to: T.List[T.Text], result: bytes) -> None:
date = datetime.now().strftime("%Y-%m-%d")
date = (datetime.now() - timedelta(days=1)).strftime("%Y-%m-%d")
body = f"Resoconto dei voli dal sito di AdR per l'aereoporto di Ciampino in data {date}" # noqa: E501
message = MIMEMultipart()
@ -84,7 +84,7 @@ class Notifier(object):
@retry_and_log(logger, RETRIES)
def send_no_data(self, to: T.List[T.Text]) -> None:
date = datetime.now().strftime("%Y-%m-%d")
date = (datetime.now() - timedelta(days=1)).strftime("%Y-%m-%d")
body = f"""Attenzione
Nessun dato è stato trovato per i voli in data {date} dal sito di AdR per

File diff suppressed because one or more lines are too long