amazon web services - Python Boto3 AWS Multipart Upload Syntax -
i authenticating aws , using 'put_object' method on bucket object upload file. want use multipart api accomplish large files. found accepted answer in question: how save s3 object file using boto3
but when trying implement getting "unknown method" errors. doing wrong? code below. thanks!
## aws session self.awssession = session(aws_access_key_id=accesskey, aws_secret_access_key=secretkey, aws_session_token=session_token, region_name=region_type) ... # upload file s3 s3 = self.awssession.resource('s3') s3.bucket('prodbucket').put_object(key=filetoupload, body=data) # works #s3.bucket('prodbucket').upload_file(datafilename, 'prodbucket', filetoupload) # doesnt work #s3.upload_file(datafilename, 'prodbucket', filetoupload) # doesnt work
the upload_file method has not been ported on bucket resource yet. you'll need use client object directly this:
client = self.awssession.client('s3') client.upload_file(...)
Comments
Post a Comment