Reputation: 1356
I'm using botocore because I'm using python 3 and can't use boto. So I followed the example here and can upload a file
import botocore.session
session = botocore.session.get_session()
s3 = session.get_service('s3')
operation = s3.get_operation('PutObject')
endpoint = s3.get_endpoint('us-east-1')
fp = open('my_large_local_file', 'rb')
res, res_data = operation.call(endpoint, bucket='my-bucket',key='/my/key', body=fp, acl='public-read')
But I have no idea how to set the metadata and it isn't documented ANYWHERE. At random I tried just adding a metadata kwarg
, metadata={key:value}
but then it threw this error
File "/usr/local/lib/python3.2/dist-packages/botocore/auth.py", line 382, in <genexpr>
custom_headers[lk] = ','.join(v.strip() for v in
AttributeError: 'dict' object has no attribute 'strip'
But when I try to change the type from a dict so, say, a string like
metadata="{key:value}"
I then get a different error, basically saying it expects a dict
File "/usr/local/lib/python3.2/dist-packages/botocore/parameters.py", line 408, in validate
type_name='map', param=self)
botocore.exceptions.ValidationError: Invalid value (key:value) for param map:Metadata of type map
Upvotes: 0
Views: 476
Reputation: 1356
As garnaat stated, and as I later found out checking the issue list in the botocore github (and the aws-cli github) this is an unresolved issue so I'll consider this answered
Upvotes: 0