From 96092d4be36be478f9671e8940de4fd09cc6f7f0 Mon Sep 17 00:00:00 2001 From: Micah Smith Date: Thu, 23 Dec 2021 14:58:54 -0500 Subject: [PATCH] docs: use writeable streamin example for 'download_blob_to_file' (#676) Co-authored-by: Tres Seaver --- google/cloud/storage/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/google/cloud/storage/client.py b/google/cloud/storage/client.py index bef05ea91..9d1d49af8 100644 --- a/google/cloud/storage/client.py +++ b/google/cloud/storage/client.py @@ -1065,7 +1065,7 @@ def download_blob_to_file( >>> bucket = client.get_bucket('my-bucket-name') >>> blob = storage.Blob('path/to/blob', bucket) - >>> with open('file-to-download-to') as file_obj: + >>> with open('file-to-download-to', 'w') as file_obj: >>> client.download_blob_to_file(blob, file_obj) # API request. @@ -1074,7 +1074,7 @@ def download_blob_to_file( >>> from google.cloud import storage >>> client = storage.Client() - >>> with open('file-to-download-to') as file_obj: + >>> with open('file-to-download-to', 'w') as file_obj: >>> client.download_blob_to_file( >>> 'gs://bucket_name/path/to/blob', file_obj)