From 0f9519ade58173de0b564058ff7588b471cd7c65 Mon Sep 17 00:00:00 2001 From: Mark Powers Date: Sat, 26 Sep 2020 19:00:25 -0500 Subject: Add wikipedia, wikiquote, and calvin and hobbes links --- daily-update.py | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'daily-update.py') diff --git a/daily-update.py b/daily-update.py index f9c402d..165372a 100755 --- a/daily-update.py +++ b/daily-update.py @@ -10,6 +10,7 @@ from bs4 import BeautifulSoup from email.mime.text import MIMEText from email.utils import formatdate +import on_this_day import email_helper from config import config @@ -19,20 +20,6 @@ def get_weather(): soup = BeautifulSoup(requests.get(weather_url).text, features="lxml") return str(soup.select("#detailed-forecast")[0]) -def get_old_news(): - print("getting old news") - year = int(date.today().strftime("%Y")) - 100 - century_ago = str(year) + date.today().strftime("-%m-%d") - news_text = "" - urls = config["news"]["urls"].split(",") - names = config["news"]["names"].split(",") - for i in range(len(urls)): - full_url = urls[i] % century_ago - name = names[i] - if requests.get(full_url).status_code != 404: - news_text += '%s %s\n' % (full_url, name, century_ago) - return news_text - def get_unread_reminders(): print("getting unread reminders") subjects = email_helper.filter_unread("subject", "REMINDER:", "subject") @@ -47,7 +34,7 @@ def get_unread_reminders(): def format_email(): print("forming email") - return '%s%s%s' % (get_unread_reminders(), get_old_news(), get_weather()) + return '%s%s%s' % (get_unread_reminders(), on_this_day.get_on_this_day(), get_weather()) def send_update_email(): frm = config["email"]["user"] -- cgit v1.2.3