This is a Python3 command-line app that will send the current weather forecast and the listed day's schedule to a list of emails.
Project Requirements
You must have Python 3.4+ installed to run this application. The development test site used Python 3.6.3, but I believe that 3.4+ will be fine.
To clone this app, enter these commands:
git clone https://github.com/SHoar/py-weather-forecast-email.git &&
cd py-weather-forecast-email
This email smtp handler sends email with TLS encryption. If you are using GMail to send your emails, you must either change your sender email account to 'allow less secure apps' or use App Passwords, but this application repo is using the former method.
In order to use this applications, there are three required files you will need:
- emails.txt - This file must list the emails that will be sent to, in order of
email_address , name
on each line. This file has not been included, and you must create it on your own. - schedule.txt - This file will have a list of events and times, with each line being one event. You may use the file included, but I suggest putting in your own real schedule.
- secrets.py - This application utilizes the OpenWeatherMaps Current Weather API. You will need to sign up for an API key, if you have not already done so, and use it as the APP_ID for the query string inside
weather.py
The application will ask you what city you want to look up. Once the query is made, this city's weather will be sent to each email in the emails.txt
file, along with the schedule that is in schedule.txt
.
The command-line tool will ask you for your email password, but it uses the python library getpass
to prompt the user, so the password will not be seen in the terminal as it is typed.
To run the program, there are a couple different ways to do it. If you like typing alot, type: python3 emailer.py
and hit enter to run.
If you prefer shortcuts, I've created a Windows batch file (weather.bat
), or weather.sh
if you prefer bash/linux shell.
So, to execute--
On Windows:
- double-click
weather.bat
from the File Explorer, or run it from the commmand prompt in Powershell or the MS-DOS prompt.
- From the terminal, run
bash weather.sh
orsh weather.sh
You should be confirmed with a count of how many emails have been sent when the process has finished.