I am trying to download the xlsx blob file from azure storage through my browser using FastAPI in the backend:
def download_blob(blob_service_client, filename: str, container: str):
try:
blob_client = blob_service_client.get_blob_client(container=container, blob=filename)
blob_url = blob_client.url
return FileResponse(content=blob_url, status_code=200, media_type='application/vnd.ms-excel', filename="Test.xlsx")
except Exception as e:
return JSONResponse(content={"message": "File is not downloaded."}, status_code=500)
# blob_url looks like this
blob_url = "https://testapp.blob.core.windows.net/test-container/test-sample.xlsx"
but I am getting status code 500 in response.
anybody guide me how can I download the file?