Hello Tidbyt community!
Just starting my dev journey, so forgive if obvious.
As a proof-of-concept, I just want my Tidbyt to poll (i.e. GET) the contents of a URL on a steady rhythm. Basically, “every 2 seconds, .GET() this URL, and display it”.
I followed the caching tutorial (in the bitcoin tracking example), and added ttl_seconds to my http.get(), thinking this is it.
Sadly , the Tidbyt only displays the text of the URL from the time I rendered the app onto the hardware. How can I get it to keep polling??
My code:
load("render.star", "render")
load("http.star", "http")
URL = "https://[some-url]/test.txt"
def main():
rep = http.get(URL, ttl_seconds = 2)
if rep.status_code != 200:
fail("Rquest failed with status %d", rep.status_code)
print(rep.body())
return render.Root(
child = render.Text(rep.body())
)
Thanks, all!