I'm trying to upload a file in my s3 bucket using a pre-signed URL, it works perfectly and uploads the data to the bucket successfully, however, the files that I upload are very large and I need to be able to show the progress bar. I have tried many solutions available on StackOverflow and other blog posts but nothing seems to be helping.
Following is the code snippet that uploads the data to s3 using a pre-signed URL.
object_name = 'DataSet.csv'
response = create_presigned_post("mybucket_name",object_name)
fields = response['fields']
with open(object_name, 'rb') as f:
files = {'file': (object_name, f)}
http_response = requests.post(response['url'], data=fields, files=files,stream=True)
print (http_response.status_code)
it returns the 204 status which is for a successful upload.
Now, what changes I can make to this code to show the progress bar.
P.S
I have tried stream=True in requests not working.
I have tried iterating over the response using tqdm but it not works in that case also.