biks
biks

Reputation: 25

'put_object() only accepts keyword arguments.'

I am getting the error "'put_object() only accepts keyword arguments.' while uploading a memory uploaded file in S3.

upload_file1 = request.FILES.get('upload_file1')
file_name1 = upload_file1._name
upload_file_path = 'Client/' + client_id + '/' + file_name1
s3.put_object(settings.AWS_STORAGE_BUCKET_NAME,Body=upload_file1,Key=upload_file_path )

please suggest

Upvotes: 2

Views: 9344

Answers (2)

chirag golechha
chirag golechha

Reputation: 11

Mention the parameter name while calling the method. For example:

s3.put_object(Bucket='your_bucket_name', Key='your_key', Body=Data)

Upvotes: 0

Chris Williams
Chris Williams

Reputation: 35146

You are not specifying your Bucket with the parameter name.

Instead it should be

s3.put_object(Bucket=settings.AWS_STORAGE_BUCKET_NAME,Body=upload_file1,Key=upload_file_path )

Upvotes: 3

Related Questions