Quantcast
Channel: Call a Flask function every few minutes - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Call a Flask function every few minutes

$
0
0

On my HTML page I've got a span that gets the value of the function getStatus():

<span id="sysStatus" style="font-weight: bold;">{{ status }}</span>

The function that returns status:

def getStatus():    state = database().getState()    if state:        status = " On"    else:        status = "Off"    return status

Rendering the html page:

class Tongles(flask.views.MethodView):    def get(self):        return flask.render_template('page.html', status=getStatus())

I would like somehow to dynamically refresh the status of the system, and the text on the span.

How can I recall the function getStatus without reloading the whole page?


Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>