Tag Archives: WeatherAlerts

Severe Weather Alerts API – JSON Web Service

I’ve had a couple requests over the past few months to add a webservice to my WeatherAlerts project, the code for this is now functional (and working quite well) but I’m doing some testing with it before I release the new version. If you’d like to experiment with the webservice you can either run an instance yourself (three lines of code to get up and running) or use my reference/test implementation. The new feature is on the development branch of WeatherAlerts on github and you can find the documentation for it here.

If you’d like to try out a live instance, you can experiment with mine which is located at http://wxalertws.zebpalmer.com/  take a look at the documentation for how it works, but currently there are only two endpoints. First hitting http://wxalertws.zebpalmer.com/all will give you json output of all active alerts in the US. If you want to get just your own area’s alerts, look up your SAMECODE  and query the API like so: http://wxalertws.zebpalmer.com/samecodes/016027,016001   replacing those samecodes with one or more samecodes that you care about.

The data is downloaded from the National Weather Service CAP Emergency Alerts Feed via my WeatherAlerts python package and it’s updated every minute. I’ll leave this running for my own experimentation and use in my own automation projects (instead of running multiple instances of WeatherAlerts) so feel free to use if for tinkering. But standard disclaimer applies, DO NOT DEPEND ON THIS FOR IMPORTANT STUFF (including but not limited to your continued existence). Your primary source of data and alerting should be the National Weather Service and NWS Radio. 

You may ask why I’m adding a webservice to WeatherAlerts when the NWS already provides a XML/CAP feed….  1) because I am already parsing that feed via WeatherAlerts, adding a simple queryable WS API was easy, I’ll be adding other queryable fields soon 2) I hate XML 3) I’ve had several requests for it

Enjoy.

Posted in Tech Also tagged , |

WeatherAlerts Use Metrics

A couple years ago, I was needing a python script that would grab realtime Severe Weather Alerts and integrate that data into my Home Automation project. I couldn’t find anything (in any non-horrible programming language) that did what I wanted. So, I wrote a script to do it. It stayed hidden in the depths of my home automation project for several months until an acquaintance asked for a copy. I decided to go ahead and open source script, throwing it in a public github repo and packaging it for inclusion in PyPI. It’s called “WeatherAlerts.”  

Let me be completely clear, this package was a mess. It was my first foray into python packaging and it showed. It was also written much earlier in my python days, but, it worked (mostly). I decided that since it worked, if someone else could find use for it, or at least give them a starting point toward making something better… in the spirit of Open Source, I’d throw it out there. It’s had a few improvements over the past two years and recently it’s gotten much better but it’s still a functional mess though I’m working to fix that (the mess part).

Last year, my WeatherAlerts python package had a total of 3,574 downloads on PyPI. This year, it’s already at 2,409 with 1,287 so far this month… Since these numbers are just PyPI download counts, I don’t have any analytics on which to ponder, which drives me nuts. I do have analytics on the documentation I’ve posted and it has show a similar uptick recently. But it’s rather difficult to equate downloads to actual users considering bot downloads, redownloads, installs that are never used, cosmic events, etc. I’d love to know how many people actually use it…. When I decided to open source it, I assumed it might help as many as four or five users 🙂  Even if the PyPI numbers are way off, it is still being looked at a lot more than I would have expected.

Over the past few months, I’ve had a number of emails and social media contacts from users which has resulted in some great feedback and conversations. This makes me want to spend a few minutes some day to clean it up and make it presentable. 🙂 Regardless it has fulfilled the goal I had when I decided to open source it, that being to help more than 0 people, in the process I’ve learned more about python packaging, sphinx documentation and python as a whole.  

I have four public packages on PyPI and WeatherAlerts isn’t the most popular. NagParser is a package a Friend/Coworker and I open sourced shortly after I released WeatherAlerts. I just pulled the metrics for NagParser and it had over 17,300 downloads last year and is already sitting at 8,117 this year. The other two packages I have on PyPI are barely touched and getting less popular by the day (if that’s even possible) but I’m not offended, they’re very niche packages that are hardware or API subscription specific. 

I also have run my own PyPI/pip compatible server at home, for stuff that’s not quite open source ready or stuff very custom to me.

Posted in Tech Also tagged , , , |

Python Continuous Integration and Deployment (with Jenkins)

I’ve only been in the python community for about a year, so I’m still new, but I really do love coding in python. Anyway, I decided to open source a library (‘WeatherAlerts’) I started writing a few weeks ago.  I’ll post about it at some point in the future….  At first it was just a code repo on github, but after a bit of time working with it I wanted to package it and put it on pypi so it could be installed via easy_install or pip. With the state of change that python is in right now figuring out how to write the installer, have it support both python 2 and python 3 and get the package available on pypi wasn’t trivial. But now that it’s behind me, I have a much better understanding of python package management.

I had a simple test script that I was manually running every few commits and before pushing any changes out to the public repo. It worked, but being a Linux Systems Engineer though, this wasn’t going to stay that way long term. A lot of what I do in my day job is systems automation. Deploy servers, mange changes to large clusters, Continuous Integration and Continuous Delivery at the system level… So while my simple little python project was perfectly fine with being a manual build and deploy process, I couldn’t stand it.

So, I searched out a pythonic way to automate these tasks.

Continue reading »

Posted in Python, Tech Also tagged , , |