Compare commits
5 Commits
Author | SHA1 | Date |
---|---|---|
blallo | fa0023d2d1 | |
blallo | 4d1596c4a2 | |
blallo | 821335d719 | |
blallo | 635780b353 | |
blallo | 51b4e6c112 |
|
@ -35,7 +35,9 @@ class Config(object):
|
|||
content = yaml.safe_load(f)
|
||||
|
||||
self.to = get_section(content, "to")
|
||||
self.cc = get_section(content, "cc")
|
||||
|
||||
if cc := content.get("cc"):
|
||||
self.cc = cc
|
||||
|
||||
smtp = get_section(content, "smtp")
|
||||
for key in [
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
from contextlib import contextmanager
|
||||
from datetime import datetime
|
||||
from email import encoders
|
||||
from email.mime.base import MIMEBase
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
|
@ -62,6 +63,7 @@ class Notifier(object):
|
|||
body = f"Resoconto dei voli dal sito di AdR per l'aereoporto di Ciampino in data {date}" # noqa: E501
|
||||
|
||||
message = MIMEMultipart()
|
||||
message["Date"] = datetime.now().strftime("%a, %d %b %Y %H:%M:%S %z")
|
||||
message["From"] = self._from
|
||||
message["To"] = ",".join(to)
|
||||
if cc:
|
||||
|
@ -82,7 +84,10 @@ class Notifier(object):
|
|||
|
||||
email = message.as_string()
|
||||
|
||||
self.send(to, email)
|
||||
rcpt = to
|
||||
rcpt.extend(cc)
|
||||
|
||||
self.send(rcpt, email)
|
||||
|
||||
@retry_and_log(logger, RETRIES)
|
||||
def send_no_data(self, to: T.List[T.Text], cc: T.List[T.Text]) -> None:
|
||||
|
@ -95,6 +100,7 @@ il vostro tecnico preferito.
|
|||
"""
|
||||
|
||||
message = MIMEMultipart()
|
||||
message["Date"] = datetime.now().strftime("%a, %d %b %Y %H:%M:%S %z")
|
||||
message["From"] = self._from
|
||||
message["To"] = ",".join(to)
|
||||
if cc:
|
||||
|
@ -104,4 +110,7 @@ il vostro tecnico preferito.
|
|||
message.attach(MIMEText(body, "plain"))
|
||||
email = message.as_string()
|
||||
|
||||
self.send(to, email)
|
||||
rcpt = to
|
||||
rcpt.extend(cc)
|
||||
|
||||
self.send(rcpt, email)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[project]
|
||||
name = "latecomers"
|
||||
version = "0.3.1"
|
||||
version = "0.3.3"
|
||||
description = "Retrieve and save data from ADR Ciampino airport"
|
||||
authors = [{name="Leonardo Barcaroli", email="blallo@autistici.org"}]
|
||||
license = {text="Public Domain"}
|
||||
|
|
Loading…
Reference in New Issue