I want to get a PDF file from s3 and then return it to the frontend from FastAPI backend.
This is my code:
@router.post("/pdf_document")
def get_pdf(document : PDFRequest) :
s3 = boto3.client('s3')
file=document.name
f=io.BytesIO()
s3.download_fileobj('adm2yearsdatapdf', file,f)
return StreamingResponse(f, media_type="application/pdf")
This API returns 200 status code, but it does not return the PDF file as a response.