send_file to aws-s3 returns 400 BadRequest

657 views
Skip to first unread message

Pay Leo

unread,
Jul 20, 2013, 11:48:49 PM7/20/13
to boto-...@googlegroups.com

I use boto's send_file to upload file to ams-s3, it return 400 Bad Request but the body is empty, so I can't find the error code

here is the code

s3_conn = boto.connect_s3(aws_config.access_key, aws_config.secret_key)
bucket = s3_conn.get_bucket('bucketname')
k=Key(bucket)
k.key='somekey'
k.send_file(open('somefile'))

response

boto.exception.S3ResponseError: S3ResponseError: 400 Bad Request
// these is no error code

if I change code

s3_conn = boto.connect_s3(aws_config.access_key, aws_config.secret_key)
bucket = s3_conn.get_bucket('bucketname')
k=Key(bucket)
k.key='somekey'
#k.send_file(open('somefile'))
k.set_contents_from_string(open('somefile').read())

everything is right

Reply all
Reply to author
Forward
0 new messages