From 3fa3174c3afc4a9507917ad992a63b451c771b6c Mon Sep 17 00:00:00 2001 From: HemangChothani Date: Wed, 23 Dec 2020 12:59:24 +0530 Subject: [PATCH] fix: expose num_retries parameter for blob upload methods --- google/cloud/storage/blob.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/google/cloud/storage/blob.py b/google/cloud/storage/blob.py index f7bf720c8..f06eabcca 100644 --- a/google/cloud/storage/blob.py +++ b/google/cloud/storage/blob.py @@ -2362,6 +2362,7 @@ def upload_from_filename( self, filename, content_type=None, + num_retries=None, client=None, predefined_acl=None, if_generation_match=None, @@ -2406,6 +2407,15 @@ def upload_from_filename( (Optional) The client to use. If not passed, falls back to the ``client`` stored on the blob's bucket. + :type num_retries: int + :param num_retries: + Number of upload retries. By default, only uploads with + if_metageneration_match set will be retried, as uploads without the + argument are not guaranteed to be idempotent. Setting num_retries + will override this default behavior and guarantee retries even when + if_metageneration_match is not set. (Deprecated: This argument + will be removed in a future release.) + :type predefined_acl: str :param predefined_acl: (Optional) Predefined access control list @@ -2460,6 +2470,7 @@ def upload_from_filename( self.upload_from_file( file_obj, content_type=content_type, + num_retries=num_retries, client=client, size=total_bytes, predefined_acl=predefined_acl, @@ -2475,6 +2486,7 @@ def upload_from_string( self, data, content_type="text/plain", + num_retries=None, client=None, predefined_acl=None, if_generation_match=None, @@ -2510,6 +2522,15 @@ def upload_from_string( (Optional) Type of content being uploaded. Defaults to ``'text/plain'``. + :type num_retries: int + :param num_retries: + Number of upload retries. By default, only uploads with + if_metageneration_match set will be retried, as uploads without the + argument are not guaranteed to be idempotent. Setting num_retries + will override this default behavior and guarantee retries even when + if_metageneration_match is not set. (Deprecated: This argument + will be removed in a future release.) + :type client: :class:`~google.cloud.storage.client.Client` :param client: (Optional) The client to use. If not passed, falls back to the @@ -2568,6 +2589,7 @@ def upload_from_string( file_obj=string_buffer, size=len(data), content_type=content_type, + num_retries=num_retries, client=client, predefined_acl=predefined_acl, if_generation_match=if_generation_match,