diff --git a/google/cloud/storage/blob.py b/google/cloud/storage/blob.py index 0d412447b..d29e1e1a8 100644 --- a/google/cloud/storage/blob.py +++ b/google/cloud/storage/blob.py @@ -1874,6 +1874,9 @@ def update_storage_class(self, new_class, client=None): crc32c = _scalar_property("crc32c") """CRC32C checksum for this object. + This returns the blob's CRC32C checksum. To retrieve the value, first use a + reload method of the Blob class which loads the blob's properties from the server. + See `RFC 4960`_ and `API reference docs`_. If not set before upload, the server will compute the hash. @@ -1881,6 +1884,22 @@ def update_storage_class(self, new_class, client=None): :rtype: str or ``NoneType`` .. _RFC 4960: https://tools.ietf.org/html/rfc4960#appendix-B + + Example: + Retrieve the crc32c hash of blob. + + >>> from google.cloud import storage + >>> client = storage.Client() + >>> bucket = client.get_bucket("my-bucket-name") + >>> blob = bucket.blob('my-blob') + + >>> blob.crc32c # return None + >>> blob.reload() + >>> blob.crc32c # return crc32c hash + + >>> # Another approach + >>> blob = bucket.get_blob('my-blob') + >>> blob.crc32c # return crc32c hash """ @property @@ -1954,6 +1973,9 @@ def id(self): md5_hash = _scalar_property("md5Hash") """MD5 hash for this object. + This returns the blob's MD5 hash. To retrieve the value, first use a + reload method of the Blob class which loads the blob's properties from the server. + See `RFC 1321`_ and `API reference docs`_. If not set before upload, the server will compute the hash. @@ -1961,6 +1983,22 @@ def id(self): :rtype: str or ``NoneType`` .. _RFC 1321: https://tools.ietf.org/html/rfc1321 + + Example: + Retrieve the md5 hash of blob. + + >>> from google.cloud import storage + >>> client = storage.Client() + >>> bucket = client.get_bucket("my-bucket-name") + >>> blob = bucket.blob('my-blob') + + >>> blob.md5_hash # return None + >>> blob.reload() + >>> blob.md5_hash # return md5 hash + + >>> # Another approach + >>> blob = bucket.get_blob('my-blob') + >>> blob.md5_hash # return md5 hash """ @property