Anand Bajpai Anand Bajpai - 10 months ago 60
Python Question

How to upload zip file through S3 signed URL

I am getting a signed URL from S3 and then tried a file upload using POSTMAN

File is getting uploaded but not full data as the result file is getting corrupted.

When I tried to do it via python requests module as

f= open("")
d =
req = requests.put(s3URL, data=d)

The results are same.

But When I do

f = open("", "rb")
d =
req = requests.put(s3URL, data=d)

It works fine. Whole file get uploaded.

So any ideas do it via POSTMAN or without reading the file in binary mode.

because I don't have option to tell the client side that open your file binary mode.


Answer Source

So When you open a file in Binary mode, you dont need any encoding. But on other hand direct upload needs a base64 encoding

refer this