Set metadata in Google Cloud Storage using gcloud-python
We discussed on the issue tracker and it surfaced a "bug" in the implementation, or at the very least something which catches users off guard.
Accessing metadata
via blob.metadata
is read-only. Thus when mutating that result via
blob.metadata['Color'] = 'Pink'
it doesn't actually change the metadata stored on blob
.
The current "fix" is to just build up
metadata = {'Color': 'Pink'}
blob.metadata = metadata