Collects WA Covid-19 Exposure Locations from:
- Healthy WA's Covid19 Exposure Locations
- Unofficial Civilian Compiled Exposure Sites - Contribute Here
- Edith Cowan University
- University of Western Australia
- Murdoch University
- Curtin University
and sends them to:
- Dreamhost announce lists
- Slack
- Discord
### CONFIGURATION ITEMS ###
# Debug mode disables sending of alerts
debug = True
# Database location
db_file = "/path/to/exposures.db" # will be created on first use
# Email details
emailAlerts = False
smtpServ = ""
smtpPort = ""
fromAddr = ""
replyAddr = ""
subjLine = f"Alert: Updated WA covid-19 exposure sites ({date_time})"
destAddr = [
"[email protected]",
"[email protected]"
]
# Slack Alerts
slackAlerts = False
webhook_urls = [
"https://hooks.slack.com/services/XXXXXXX/XXXXXXX/XXXXXXX",
"https://hooks.slack.com/services/XXXXXXX/XXXXXXX/XXXXXXX"
]
# Discord Alerts
discordAlerts = False
discord_webhook_urls = [
"https://discordapp.com/api/webhooks/XXXXXXX/XXXXXXX",
"https://discordapp.com/api/webhooks/XXXXXXX/XXXXXXX"
]
# Dreamhost Announce
dreamhostAnounces = False
apiKey = ""
listDomain = ""
listName = ""
subjLine = f"Alert: Updated WA covid-19 exposure sites ({date_time})"
### END OF CONFIGURATION ITEMS
pip3 install requests lxml sqlite3 pytz
*/15 * * * * /usr/bin/python3 /path/to/wacovidmailer.py > /dev/null 2>&1
An instance of the code is running and is available at https://exposures.kronicd.net, which is configured as follows:
- Custom PHP is used to add and remove email addresses from a dreamhost announcement mailing list
wacovidmailer.py
is configured to run every 15 minutes and has theDreamhost Announce
configuration items filled out- Dreamhost manages the mailing list functionality including confirmation emails for subscribe actions
- The PHP code is not included as part of this release as it would be of limited use and add significant confusion for those attempting deployment
The core of the subscription function is essentially:
if($invalid == False) {
$format = 'https://api.dreamhost.com/?key=%s&cmd=announcement_list-add_subscriber&listname=LISTNAME&domain=DOMAIN&email=%s';
$subUrl = sprintf($format, $apiKey, $email);
file_get_contents($subUrl);
$msg = "You have been subscribed to the mailing list. Please check your email for a confirmation link, you may need to check your spam folder.";
} else {
$msg = "Email address invalid or not supplied.";
}
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.