Check for json change in python -
i running this python code on raspberry pi, checks usgs data , finds magnitude of earthquakes within last hour. problem json changing. how make keep checking see if changed again?
the simplest setup periodically run request logic on , over, caching results each time, perhaps optional increasing backoff if several requests yield same results.
you compare new parsed values previous ones if delta care about, or replace inline if you're want ensure freshest. since json.loads
default deserializes dictionary, standard dictionary methods available make comparisons.
very simple examples of timed-interval callbacks available on other posts
alternatively there heavier solutions apscheduler, though that's lot more you'd interested in raspberry pi.
Comments
Post a Comment