title: How to send a progress of operation in a FastAPI app?
body: <p>I have deployed a fastapi endpoint,</p>
  <pre><code>from fastapi import FastAPI, UploadFile
  from typing import List
  
  app = FastAPI()
  
  @app.post('/work/test')
  async def testing(files: List(UploadFile)):
      for i in files:
          .......
          # do a lot of operations on each file
  
          # after than I am just writing that processed data into mysql database
          # cur.execute(...)
          # cur.commit()
          .......
      
      # just returning &quot;OK&quot; to confirm data is written into mysql
      return {&quot;response&quot; : &quot;OK&quot;}
  </code></pre>
  <p>I can request output from the API endpoint and its working fine for me perfectly.</p>
  <p>Now, the biggest challenge for me to know how much time it is taking for each iteration. Because in the UI part (those who are accessing my API endpoint) I want to help them show a progress bar (TIME TAKEN) for each iteration/file being processed.</p>
  <p>Is there any possible way for me to achieve it? If so, please help me out on how can I proceed further?</p>
  <p>Thank you.</p>