I have an API that must return just blank and status as 200 OK in case there is no data available
I have tried following things and facing these error
if df.empty:
   return '' , 200
Run Code Online (Sandbox Code Playgroud)
This returns "" in the browser
if df.empty:
   return json.loads('{}'), 200
Run Code Online (Sandbox Code Playgroud)
This return {} in the browser
Send status as 204 (NO CONTENT) makes the previous content to be as it is on the browser
How can i return complete blank with status as 200?
我在彻底探索 Flask 文档后找到了解决方案
from flask import Response
.....
if df.empty:
   return Response(status = 200)
Run Code Online (Sandbox Code Playgroud)
        |   归档时间:  |  
           
  |  
        
|   查看次数:  |  
           5651 次  |  
        
|   最近记录:  |