'Display the construction of a json object with python flask on browser in real time

I have an object which I carry on and add to it(inflate) at the end of different functions inside my scripts files. I want to be able to display in real time how the object is built while the scripts are called. I will use flask to create a web_interface to input data into this program.

How should I proceed for displaying that object in its own path, so when user hits refresh on browser, it will show the object as it is built up to that time. I’m looking for best practice, suggestions or links to look at, and what should be changed inside the functions, like the using of yield or other constructions.

def ping()
 do()
 ipm.update('IPM': {'ping': {...} )

def ssh()
 do()
 ipm.update('IPM': {'ssh': {...})
  

ipm = {'IPM': {'ping': {...}, ssh': {'start': '2022-04-25 23:38:31.958926', 'id_string': 'SSH-2.0-Mocana SSH', ....}

http://127.0.0.1/ipm will display the above, when you refresh it first time only ping is displayed, refresh again will also show ssh data after that is collected and so on



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source