{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/issues/536","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/issues/536/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/issues/536/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/issues/536/events","html_url":"https://github.com/GoogleCloudPlatform/gcloud-python/issues/536","id":54113994,"number":536,"title":"storage: cannot set object properties","user":{"login":"pdknsk","id":1097609,"avatar_url":"https://avatars.githubusercontent.com/u/1097609?v=3","gravatar_id":"","url":"https://api.github.com/users/pdknsk","html_url":"https://github.com/pdknsk","followers_url":"https://api.github.com/users/pdknsk/followers","following_url":"https://api.github.com/users/pdknsk/following{/other_user}","gists_url":"https://api.github.com/users/pdknsk/gists{/gist_id}","starred_url":"https://api.github.com/users/pdknsk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pdknsk/subscriptions","organizations_url":"https://api.github.com/users/pdknsk/orgs","repos_url":"https://api.github.com/users/pdknsk/repos","events_url":"https://api.github.com/users/pdknsk/events{/privacy}","received_events_url":"https://api.github.com/users/pdknsk/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/labels/storage","name":"storage","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/milestones/6","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/milestones/6/labels","id":958844,"number":6,"title":"Storage Stable","description":"","creator":{"login":"jgeewax","id":112928,"avatar_url":"https://avatars.githubusercontent.com/u/112928?v=3","gravatar_id":"","url":"https://api.github.com/users/jgeewax","html_url":"https://github.com/jgeewax","followers_url":"https://api.github.com/users/jgeewax/followers","following_url":"https://api.github.com/users/jgeewax/following{/other_user}","gists_url":"https://api.github.com/users/jgeewax/gists{/gist_id}","starred_url":"https://api.github.com/users/jgeewax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgeewax/subscriptions","organizations_url":"https://api.github.com/users/jgeewax/orgs","repos_url":"https://api.github.com/users/jgeewax/repos","events_url":"https://api.github.com/users/jgeewax/events{/privacy}","received_events_url":"https://api.github.com/users/jgeewax/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":74,"state":"open","created_at":"2015-01-30T20:34:25Z","updated_at":"2015-02-12T23:03:23Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2015-01-12T22:07:44Z","updated_at":"2015-02-13T00:10:35Z","closed_at":null,"body":"Or at least I haven't figured out how. This is how the documentation suggests it may work.\r\n\r\n```Python\r\n>>> from gcloud import storage\r\n>>> bucket = storage.get_bucket('bucket', 'id')\r\n>>> key = storage.key.Key(bucket=bucket, name='dir/file.webp', \r\n...                       properties={'contentType': 'image/webp'})\r\n>>> key.upload_from_filename('dir/file.webp')\r\n```\r\nSuccess?\r\n```Python\r\n>>> key.properties['contentType']\r\n'image/webp'\r\n>>> key.content_type\r\n'image/webp'\r\n```\r\nIt's a lie unfortunately. (Also verified with ```gsutil```).\r\n```Python\r\n>>> webp = bucket.get_key('dir/file.webp')\r\n>>> webp.properties['contentType']\r\nu'application/unknown'\r\n>>> webp.content_type\r\nu'application/unknown'\r\n```"},"comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/issues/comments/74181002","html_url":"https://github.com/GoogleCloudPlatform/gcloud-python/issues/536#issuecomment-74181002","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/issues/536","id":74181002,"user":{"login":"dhermes","id":520669,"avatar_url":"https://avatars.githubusercontent.com/u/520669?v=3","gravatar_id":"","url":"https://api.github.com/users/dhermes","html_url":"https://github.com/dhermes","followers_url":"https://api.github.com/users/dhermes/followers","following_url":"https://api.github.com/users/dhermes/following{/other_user}","gists_url":"https://api.github.com/users/dhermes/gists{/gist_id}","starred_url":"https://api.github.com/users/dhermes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhermes/subscriptions","organizations_url":"https://api.github.com/users/dhermes/orgs","repos_url":"https://api.github.com/users/dhermes/repos","events_url":"https://api.github.com/users/dhermes/events{/privacy}","received_events_url":"https://api.github.com/users/dhermes/received_events","type":"User","site_admin":false},"created_at":"2015-02-13T00:10:35Z","updated_at":"2015-02-13T00:10:35Z","body":"So the core issue here is that `Blob.upload_from_filename` uses `mimetypes` rather than the given `content_type`. I tested with a [real webp file][2] and `mimetypes` doesn't know what to think.\r\n\r\nYou could \"get around this\" by [using `upload_from_file`][1]  directly.\r\n\r\n[1]: https://gist.github.com/dhermes/ed61e3a5e8206b7be471\r\n[2]: https://www.gstatic.com/webp/gallery/4.sm.webp"}}