Portfolio Project 17: Python Automation

For this project, I branched off of the snow resort website project that was constructed for Day 96 of the 100 Days of Code Challenge. The same code was used to pull the weather data from OpenWeather, however, instead of rendering a website, that data was sent in an email.

Email screenshot with weather information

For Day 98, of the 100 Days of Code challenge, the goal was to create a program that automates some aspect of someone’s life. For the web scraping project, I created a project that scrapes housing data and sends a daily email for that data that meets the criteria that was set so that would have satisfied the requirement for today’s project. Emailing the housing data was not a requirement for that project however, I added that step as I found the data being collected very useful.

I built on the weather data collection project from day 96 and created a program that would send a daily email from the data gathered from OpenWeather. This project was smaller in scope than the housing data project and weather data website, but it did provide it’s own challenges.


Instead of rendering a website with the weather data pulled from the internet, this project instead emailed the weather information for the snow resorts that I specified.

This project had two challenges that were met and important to complete in order to finish the project. Composing the emails body using the ski & snow resort’s information and sending that data in an email.

To compose the emails body, I used for loops and f strings. This took a bit of trial and error to get the information that I wanted to display but ultimately, I was able to display the information in a format that satisfied my goal. Initially I discovered that rendering the weather information for six resorts would yield a body that was over 500 lines of text in length. I then cut the days being output from five days to three days and that shaved the emails body down to 300 or so lines. That still felt too long so I cut out some of the information being displayed on each line of text and combined the information printed for each time increment to fit on one line instead of two. This ultimately got the emails body down to about 170 lines of text.

Another challenge that stemmed from the very large email body that was being composed was that I would run into a UnicodeEncodeError when trying to send the email using smtplib’s sendmail method. To get around this I had to do a bit of online research and ended up using the send_message() method. Using send_message, I was able to successfully send an email with the text being displayed properly.

Email sytax code needed to send email.

After the projects scope was satisfied, this script was then passed through a ps1 file to be run using Windows Task Scheduler.


Although this project was easier to complete than previous projects, it did provide its own challenges and required more work to complete than I thought it would. As stated for my takeaways from the original project, and even the housing data project, it was enjoyable working with real life data that I found interesting and useful.