#fastapi #python #aws #awss3 #s3 #webdevelopment Hello everyone This video gives a demo on how you can download a file from AWS S3 using FastAPI. Happy coding!! Links: AWS CLI: docs.aws.amazo... boto3 credentials: boto3.amazonaw...
@jr.developer I have tried for a larger zip file with streaming response, once the file is available to download then chrome is crashing and unable to view swagger.. So I'm unable to download the file.. So instead of that can we directly download into the downloads folder whenever api is called?
@jr.developer6 ай бұрын
Swagger might be overwhelmed by the large file size. It's just for us to understand and document our APIs easily. You can put the endpoint in the browser and that should start the download process. For the browser to show the download progress - try adding the Content-Length header in the response. Hope that helps. Thank you for your comment.
@hackwithharsha Жыл бұрын
Hey, Thank You !! What is the python version that you are using, instead of Union you seem to be using pipe symbol..
@jr.developer Жыл бұрын
I'm using Python 3.10 which supports this symbol( | ). You can still use Union if you want to 🙂
@hackwithharsha Жыл бұрын
@@jr.developer Okiee. Thank You !!
@khyatisonkar Жыл бұрын
hi, how can we download all files present inside the amazon s3 bucket?
@jr.developer Жыл бұрын
Great question! I have never run into a situation where I needed to download all files from s3(which might take a significant amount of time based on the number of files in your bucket). I found a few interesting solutions on stackoverflow: stackoverflow.com/questions/31918960/boto3-to-download-all-files-from-a-s3-bucket. Hope that helps...
@gopikrishna34816 ай бұрын
Does the download api work for larger files with size greater than 2GB
@jr.developer6 ай бұрын
It would be limited by the available disk space. I would definately not consider this for large files. For large files, we can consider streaming. I haven't tried it myself yet but I found a FastAPI + boto example - stackoverflow.com/questions/69617252/response-file-stream-from-s3-fastapi
@gopikrishna34816 ай бұрын
@@jr.developerI have tried for a larger zip file with streaming response, once the file is available to download then chrome is crashing and unable to view swagger.. So I'm unable to download the file.. So instead of that can we directly download into the downloads folder whenever api is called?
@jr.developerАй бұрын
Swagger is not the way to interact with your API. It's just for documentation purposes and quickly becomes unresponsive even for a large JSON response. Please, consider opening the API endpoint in a browser directly and the browser should let you choose a location on your computer.
@artemshumeiko Жыл бұрын
Thanks a lot! Do you have same code version with aioboto3 implemented instead boto3?
@jr.developer Жыл бұрын
Sorry, but I haven't tried that yet. It should be similar to boto3 though.
@nikilkvn Жыл бұрын
Thanks so much for the content.,. But I was getting "Object of type bytes is not JSON serializable" tried the exact same code.. am able to print the contents in bytes.. but the response is failing somehow..
@nikilkvn Жыл бұрын
my mistake.. I was using JsonResponse instead the regular Response. Thanks a lot for the video.
@azabelletale5013 Жыл бұрын
Thank you for the great video. It saved me. Would you please do a video for how to do it with authorization (jwt) as well?