I have some code which outputs information as it is acquired. Like this:
while not search_complete:
bulk_results = session.get(urljoin(secrets['baseurl'],bulk_string), headers={'Content-Type':'application/json', 'PAPI-Use-Prefixes':'false' }, proxies=proxies)
pprint(bulk_results.json())
if bulk_results.json()['searchTargetStatus'] == 'COMPLETE':
search_complete = True
pprint(bulk_results.json())
So, the 4th line will print over and over as 'searchTargetStatus' remains "PENDING", then once it is "COMPLETE" line 7 prints a final output.
I need the PENDING prints and the final output to be able to be seen on a website page hosted using Gunicorn and Flask (also uses Flash for some popup messages). The preference would be for continuous output into some kind of frame view field until the code is finished. Whatever Python would print to my IDE would be fine to see on the page. Like an AWS deployment shows logs as different pieces of the deployment occurs, until done.
However, I would be fine with an all at once output, as long as it reaches the web page and shows the same info that I can see in my CLI (or IDE) from the Python print command output.