Skip to content

Commit 20ebf60

Browse files
authored
docs(storage): clarify docstring for 'Blob.download_as_string' (#9332)
Specify that the returned value is bytes in the summary. Closes #9290.
1 parent cb5170b commit 20ebf60

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

storage/docs/snippets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def storage_get_started(client, to_delete):
3939
bucket = client.get_bucket("bucket-id-here")
4040
# Then do other things...
4141
blob = bucket.get_blob("/remote/path/to/file.txt")
42-
assert blob.download_as_string() == "My old contents!"
42+
assert blob.download_as_string() == b"My old contents!"
4343
blob.upload_from_string("New contents!")
4444
blob2 = bucket.blob("/remote/path/storage.txt")
4545
blob2.upload_from_filename(filename="/local/path.txt")

storage/google/cloud/storage/blob.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ def download_to_filename(self, filename, client=None, start=None, end=None):
712712
os.utime(file_obj.name, (mtime, mtime))
713713

714714
def download_as_string(self, client=None, start=None, end=None):
715-
"""Download the contents of this blob as a string.
715+
"""Download the contents of this blob as a bytes object.
716716
717717
If :attr:`user_project` is set on the bucket, bills the API request
718718
to that project.

0 commit comments

Comments
 (0)