Custom API Website: Local Ski & Snow Resort Weather Website
For day 96, I created a website using Flask and the Open Weather API to create a website that displays weather information from local ski & snow resorts.
Project Goals & Steps to Complete
For this project, the goals were to create a website that pulled data from a public API. For the project, I decided to create a Flask website using weather data pulled using the Open Weather API. Particularly, I pulled weather data from local snow resorts in my area using Open Weather’s 3 Hour / 5 Day API call. This API call pulled weather data for five days in three-hour increments for a specified location.
Project Challenges
This project was completed following the high-level steps listed.
- Connect to the OpenWeather API endpoint and pull weather data for a specified location.
- Save the data pulled from the coordinates passed through locally so that testing can be performed offline. Using this offline data, I parsed through the necessary information to gather what I wanted.
- After offline work was completed, I then looped through the rest of the coordinates to gather all the information needed to render the web pages.
- HTML pages and CSS was constructed.
- After HTML and CSS was finished, Weather data was then used to render on Flask Web pages.
The biggest challenges encountered working on this project were parsing through the JSON data pulled from the OpenWeather API and transforming that data to be rendered properly on the web pages.
Initially, I was hoping to render data for the resort’s weather table from the dictionaries that were constructed for each resort without transforming them further. However, I quickly realized that I would have to transform that data further to properly render the table rows.
I ended up utilizing multiple loops to create the dictionaries and lists that are comprised of resort and weather information. After those data structures were created, I then used additional loops to construct the rows that would be rendered on the resort’s weather information pages.
Project Takeaways
This project was a fun project to complete. It was another Flask application that utilized live information from an API endpoint. The work in flask was far easier than other projects completed however, it was a nice refresher working with OpenWeather’s API and transforming that data to appear how I wanted it to appear. Additionally, I chose to work with weather information because it allowed me to look at local information that I found interesting and useful.