aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xdaily.py6
-rwxr-xr-xlegacy_wikipedia.py8
2 files changed, 10 insertions, 4 deletions
diff --git a/daily.py b/daily.py
index e456a9b..d789b2d 100755
--- a/daily.py
+++ b/daily.py
@@ -203,6 +203,9 @@ def generate(
inspiration_text = None
inspiration_image_fn = None
+ logger.info("Finished processing inspirations")
+ logger.info("Starting On This Day")
+
on_this_day_html_en: typing.Optional[str]
try:
with open("otd_en-%s.html" % datetime_target.strftime("%m-%d"), "r") as fd:
@@ -217,9 +220,12 @@ def generate(
except FileNotFoundError:
on_this_day_html_zh = None
logger.warning("On This Day Chinese not found")
+ logger.info("Finished On This Day")
+ logger.info("Starting In The News")
in_the_news_html_en = legacy_wikipedia.get_in_the_news_en()
in_the_news_html_zh = legacy_wikipedia.get_in_the_news_zh()
+ logger.info("Finished In The News")
data = {
"stddate": datetime_target.strftime("%Y-%m-%d"),
diff --git a/legacy_wikipedia.py b/legacy_wikipedia.py
index 95b2eaa..c2f60a1 100755
--- a/legacy_wikipedia.py
+++ b/legacy_wikipedia.py
@@ -42,7 +42,7 @@ def get_on_this_day_zh() -> None:
day = 1
url = "https://zh.m.wikipedia.org/zh-cn/Wikipedia:历史上的今天/" + month
- response = requests.get(url)
+ response = requests.get(url, timeout=15)
html = response.text
soup = bs4.BeautifulSoup(html, "html.parser")
div_elements = soup.find_all("div", class_="selected-anniversary")
@@ -108,7 +108,7 @@ def get_on_this_day_en() -> None:
url = (
"https://en.m.wikipedia.org/wiki/Wikipedia:Selected_anniversaries/" + month
)
- response = requests.get(url)
+ response = requests.get(url, timeout=15)
html = response.text
soup = bs4.BeautifulSoup(html, "html.parser")
p_elements = soup.find_all("p")
@@ -155,7 +155,7 @@ def get_on_this_day_en() -> None:
def get_in_the_news_en() -> str:
url = "https://en.m.wikipedia.org/wiki/Main_Page"
- response = requests.get(url)
+ response = requests.get(url, timeout=15)
html = response.text
soup = bs4.BeautifulSoup(html, "html.parser")
@@ -224,7 +224,7 @@ def get_in_the_news_en() -> str:
def get_in_the_news_zh() -> str:
url = "https://zh.m.wikipedia.org/zh-cn/Wikipedia:%E9%A6%96%E9%A1%B5"
- response = requests.get(url)
+ response = requests.get(url, timeout=15)
html = response.text
soup = bs4.BeautifulSoup(html, "html.parser")