COVID19 stats to Telegram (Python version)
Continuing my previous post about Covid19 stats.
I understand, that using Shell script to parse text table information from the site is not the most reliable method, although it is very quick and dirty to make.
Thankfully, the Coronavirus Tracker CLI project also provides statistics in JSON format. Which is more reliable and more predictable in its data structure.
Python script for pulling data
As before, I created the file in the target directory.
|
|
And then I made the Python script, which produces the same output, as a Shell script from the previous post
|
|
Then make file executable and change ownership to openhab
user, otherwise OpenHab rules engine will not be able to process the file.
|
|
OpenHab rule
It is almost the same as the rule here.
|
|