My intention is 1. performing a health check and everything is working fine, but the problem is, I get this message http://0.0.0.0:8080/ (Press CTRL+C to quit), which I have to manually do control c, for the next piece of code to work
from flask import Flask, request
from flask_restful import Resource, Api
import urllib.request as request
import time
app = Flask(__name__)
api = Api(app)
starttime=time.time()
def example_fun():
print("hello world")
class Health (Resource):
def get(self):
return "UP"
api.add_resource(Health, '/health')
if __name__ == '__main__':
app.run(host='0.0.0.0', port = '8080')
example_fun()
while True:
example_fun()
time.sleep(3)
What i expect is once app.run(host='0.0.0.0', port = '8080') is executed and it is healthy, it should continue to example_fun() and start printing the result without manually performing control + c