Weewx Scraping

In 2017, the after-school computer programming club that I manage at my school received a small grant (~$1,300) to grab a Weather Station and some accessories. The goal was to have a data set that the students could draw from in order to create a local weather site, which was successful and is currently being restyled by my students.

We’ve been using WeeWX, a free software that interacts with many types of small weather stations. WeeWX can automatically generate HTML to display weather data while logging data into a database (we use MySQL).

Database queries have not really been practical for our beginning programming students, so I wrote a quick little script with Python and BeautifulSoup4 to format the data from the WeeWX default html to a JSON file. It’s a nifty little script that gives an easily accessible dataset for current weather conditions that my students have found much easier to use.

Here is the script if any of you use WeeWX. I have it set using crontab to run when a WeeWX page is updated via rsync from a local server. It works well for my purposes.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.