I create a dashboard based on flask and dash python
How can I refresh data pulled from another .py
file with a specified interval?
I have a weather_api.py file that returns data from openweathermap API
and I refer to it such as:
html.Div(children=[
html.Div(children=[html.Img(src="http://openweathermap.org/img/wn/{}@2x.png".format(WEATHER_API.icon))]),
html.Div(children=[html.H2("{} ".format(round(WEATHER_API.current_temperature))),
html.Span(["Data", html.Br()]),
html.Span("{}".format(WEATHER_API.weather_description))]),
])
])
at the beginning of the file I import WEATHER_API
- and then it will refer to variables e.g.: html.Span("{}".format(WEATHER_API.weather_description))
I would like this data to be refreshed every e.g. 10 minutes - now it works so that the data is only from the beginning - as soon as I run the Dash, it "pulls" data from the API only once. Is it possible to somehow set up @callback
to retrieve data from WEATHER_API
every 10 minutes - as if starting WEATHER_API.py
every 10 minutes?