Closes: #1
This commit is contained in:
Edward Betts 2023-10-29 11:52:15 +00:00
parent aa24c9003f
commit 32db174fbb

View file

@ -4,10 +4,16 @@
import re
import smtplib
import warnings
from email.mime.text import MIMEText
from email.utils import formatdate, make_msgid
import requests
from urllib3.exceptions import InsecureRequestWarning
# Suppress only the single InsecureRequestWarning from urllib3
warnings.filterwarnings("ignore", category=InsecureRequestWarning)
re_title = re.compile("<title>(.*?)</title>", re.DOTALL)
@ -28,6 +34,7 @@ not_here_list = [
"This page does not exist yet",
"404 Not Found",
"500 Internal Server Error",
"Test Page for the Apache HTTP Server",
]
conferences = [
@ -45,6 +52,7 @@ conferences = [
("PyCon DE", "https://2024.pycon.de/"),
("PyData London", "https://pydata.org/london2024"),
("Pass the SALT", "https://2024.pass-the-salt.org/"),
("SotM Baltics", "https://2024.sotm-baltics.org/"),
]
@ -62,7 +70,8 @@ def get_title(html: str) -> str:
def check_conference(name: str, url: str) -> tuple[bool, str]:
"""Check if conference is live."""
try:
r = s.get(url)
# SotM Baltics has an invalid TLS certificate, but we don't care
r = s.get(url, verify=False)
except requests.exceptions.ConnectionError:
return (False, "connection refused")