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
This returns "" in the browser
if df.empty:
return json.loads('{}'), 200
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?
I have found solution after thoroughly exploring Flask documents
from flask import Response
.....
if df.empty:
return Response(status = 200)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With