Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: open file-like objects in byte mode for uploads #824

Merged
merged 4 commits into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion google/cloud/storage/blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -2456,7 +2456,7 @@ def upload_from_file(
to that project.

:type file_obj: file
:param file_obj: A file handle open for reading.
:param file_obj: A file handle opened in binary mode for reading.

:type rewind: bool
:param rewind:
Expand Down
4 changes: 2 additions & 2 deletions samples/snippets/storage_upload_from_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def upload_blob_from_stream(bucket_name, file_obj, destination_blob_name):

# The stream or file (file-like object) from which to read
# import io
# file_obj = io.StringIO()
# file_obj.write("This is test data.")
# file_obj = io.BytesIO()
# file_obj.write(b"This is test data.")

# The desired name of the uploaded GCS object (blob)
# destination_blob_name = "storage-object-name"
Expand Down