Closed
Description
Or at least I haven't figured out how. This is how the documentation suggests it may work.
>>> from gcloud import storage
>>> bucket = storage.get_bucket('bucket', 'id')
>>> key = storage.key.Key(bucket=bucket, name='dir/file.webp',
... properties={'contentType': 'image/webp'})
>>> key.upload_from_filename('dir/file.webp')
Success?
>>> key.properties['contentType']
'image/webp'
>>> key.content_type
'image/webp'
It's a lie unfortunately. (Also verified with gsutil
).
>>> webp = bucket.get_key('dir/file.webp')
>>> webp.properties['contentType']
u'application/unknown'
>>> webp.content_type
u'application/unknown'