@@ -73,7 +73,8 @@ for each method, base on its semantics:
7373 the same "generation", the library uses its
7474 :data: `~google.cloud.storage.retry.DEFAULT_RETRY_IF_GENERATION_SPECIFIED `
7575 policy, which retries API requests which returns a "transient" error,
76- but only if the original request includes an ``ifGenerationMatch `` header.
76+ but only if the original request includes a ``generation `` or
77+ ``ifGenerationMatch `` header.
7778
7879- For API requests which are idempotent only if the bucket or blob has
7980 the same "metageneration", the library uses its
@@ -99,6 +100,20 @@ explicit policy in your code.
99100
100101 bucket = client.get_bucket(BUCKET_NAME , retry = None )
101102
103+ - You can modify the default retry behavior and create a copy of :data: `~google.cloud.storage.retry.DEFAULT_RETRY `
104+ by calling it with a ``with_XXX `` method. E.g.:
105+
106+ .. code-block :: python
107+
108+ from google.cloud.storage.retry import DEFAULT_RETRY
109+
110+ # Customize retry with a deadline of 500 seconds (default=120 seconds).
111+ modified_retry = DEFAULT_RETRY .with_deadline(500.0 )
112+ # Customize retry with an initial wait time of 1.5 (default=1.0).
113+ # Customize retry with a wait time multiplier per iteration of 1.2 (default=2.0).
114+ # Customize retry with a maximum wait time of 45.0 (default=60.0).
115+ modified_retry = modified_retry.with_delay(initial = 1.5 , multiplier = 1.2 , maximum = 45.0 )
116+
102117 - You can pass an instance of :class: `google.api_core.retry.Retry ` to enable
103118 retries; the passed object will define retriable response codes and errors,
104119 as well as configuring backoff and retry interval options. E.g.:
@@ -140,5 +155,5 @@ explicit policy in your code.
140155
141156 my_retry_policy = Retry(predicate = is_retryable)
142157 my_cond_policy = ConditionalRetryPolicy(
143- my_retry_policy, conditional_predicate = is_etag_in_data)
158+ my_retry_policy, conditional_predicate = is_etag_in_data, [ " query_params " ] )
144159 bucket = client.get_bucket(BUCKET_NAME , retry = my_cond_policy)
0 commit comments