title: Is there a way to run python flask function, every specific interval of time and display on the local server the output?
body: <p>I am working python program using flask, where i want to extract keys from dictionary. this keys is in text format. But I want to repeat this above whole process after every specific interval of time. And display this output on local browser each time.  </p>
  
  <p>I have tried this using flask_apscheduler. The program run and shows output but only once, but dose not repeat itself after interval of time.</p>
  
  <p>This is python program which i tried.</p>
  
  <pre><code>@app.route('/trend', methods=['POST', 'GET'])
  def run_tasks():
      for i in range(0, 1):
          app.apscheduler.add_job(func=getTrendingEntities, trigger='cron', args=[i], id='j'+str(i), second = 5)
  
      return "Code run perfect"
  
  @app.route('/loc', methods=['POST', 'GET'])
  def getIntentAndSummary(self, request):
  
      if request.method == "POST":
  
          reqStr = request.data.decode("utf-8", "strict")
          reqStrArr = reqStr.split()
          reqStr = ' '.join(reqStrArr)
          text_1 = []
          requestBody = json.loads(reqStr)
          if requestBody.get('m') is not None:
                  text_1.append(requestBody.get('m'))
          return jsonify(text_1)
  
  if (__name__ == "__main__"):
      app.run(port = 8000)
  </code></pre>