The purpose of the project was to automate the daily checking of the weather forecast. Subscribers can choose days and hour when they will receive emails with weather information.
Script weather_info.py is launched every hour (e.g. 6:59, 7:59, etc.) by cron.
59 * * * * /usr/bin/python3 .../weather_info.py
While the program was running, all the application activities are storing in logfiles (e.g. 2020-11-25.log).
-
Gets the current date and time.
-
Fetches selected users from the database. If there are no users, the script will exit.
-
Logs in to the e-mail account using smtplib.
-
Gets the weather forecast from https://openweathermap.org/ via the API.
-
Prepares and sends email messages to each user.
-
Closes the connection to the SMTP server.
- Python 3
- MySQL
- API
- HTML, CSS
- cron