Example #1
0
 def test_create_transfer_manager_with_no_threads(self):
     client = object()
     config = TransferConfig()
     config.use_threads = False
     with mock.patch('boto3.s3.transfer.TransferManager') as manager:
         create_transfer_manager(client, config)
         assert manager.call_args == mock.call(client, config, None,
                                               NonThreadedExecutor)
Example #2
0
def upload_file(file, bucket_name, object_name):
	# f = file.read()
	# s3 = boto3.client('s3')
	# s3.upload_fileobj(file, bucket_name, object_name)
	config = TransferConfig()
	config.use_threads = False
	s3 = boto3.resource('s3')
	bucket = s3.Bucket(bucket_name)
	bucket.upload_fileobj(file, object_name, Config=config)