Double bonus is that you can use this for other Python projects where you want a Windows Toaster notification. Windows Toaster notifications are those little pop ups that appear in the bottom right corner of your screen.
I fired up Fiddler hoping to find that LCS would give me some sweet JSON action. At first I was a little bummed because the return application type showed javascript instead of JSON
After some searching I stumbled on some stack overflow articles mentioning this was JSONP not normal JSON. I finally landed at this article that gave me a really simple solution. Here is my final script to generate the Toast Messages for the LCS deployment status.
You can see where I convert the JSONP to JSON by just removing the first and last character (Line 16) of the response. It is really that simple, just remove the ( and the ) and we now have valid JSON we can feed in.
We loop every 5 minutes checking status and pop up a toast notification giving the status. Here is a screen shot showing the result (I stopped all my environments for some maintenance thus all are Stopped status).
One thing to keep in mind is you are limited on height of the toast message. So your message will be cut off if your message cannot fit in the toast notification window size.
0 comments:
Post a Comment