A class for use when an API call is only conditionally safe to retry.
This class is intended for use in inspecting the API call parameters of an
API call to verify that any flags necessary to make the API call idempotent
(such as specifying anif_generation_matchor related flag) are present.
It can be used in place of aretry.Retryobject, in which case_http.Connection.api_requestwill pass the requested api call keyword
arguments into theconditional_predicateand return theretry_policyif the conditions are met.
Parameters
Name
Description
retry_policy
class:google.api_core.retry.Retry
A retry object defining timeouts, persistence and which exceptions to retry.
conditional_predicate
callable
A callable that accepts exactly the number of arguments inrequired_kwargs, in order, and returns True if the arguments have sufficient data to determine that the call is safe to retry (idempotent).
required_kwargs
list(str)
A list of keyword argument keys that will be extracted from the API call and passed into theconditional predicatein order. For example,["query_params"]is commmonly used for preconditions in query_params.
Modules
Functions
is_etag_in_data
is_etag_in_data(data)
Return True if an etag is contained in the request body.
Parameter
Name
Description
data
dict or None
A dict representing the request JSON body. If not passed, returns False.
is_etag_in_json
is_etag_in_json(data)
is_etag_in_jsonis supported for backwards-compatibility reasons only;
please useis_etag_in_datainstead.
is_generation_specified
is_generation_specified(query_params)
Return True if generation or if_generation_match is specified.
is_metageneration_specified
is_metageneration_specified(query_params)
Return True if if_metageneration_match is specified.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Module retry (3.3.0)\n\nVersion latestkeyboard_arrow_down\n\n- [3.3.0 (latest)](/python/docs/reference/storage/latest/google.cloud.storage.retry)\n- [3.2.0](/python/docs/reference/storage/3.2.0/google.cloud.storage.retry)\n- [3.1.1](/python/docs/reference/storage/3.1.1/google.cloud.storage.retry)\n- [3.0.0](/python/docs/reference/storage/3.0.0/google.cloud.storage.retry)\n- [2.19.0](/python/docs/reference/storage/2.19.0/google.cloud.storage.retry)\n- [2.17.0](/python/docs/reference/storage/2.17.0/google.cloud.storage.retry)\n- [2.16.0](/python/docs/reference/storage/2.16.0/google.cloud.storage.retry)\n- [2.15.0](/python/docs/reference/storage/2.15.0/google.cloud.storage.retry)\n- [2.14.0](/python/docs/reference/storage/2.14.0/google.cloud.storage.retry)\n- [2.13.0](/python/docs/reference/storage/2.13.0/google.cloud.storage.retry)\n- [2.12.0](/python/docs/reference/storage/2.12.0/google.cloud.storage.retry)\n- [2.11.0](/python/docs/reference/storage/2.11.0/google.cloud.storage.retry)\n- [2.10.0](/python/docs/reference/storage/2.10.0/google.cloud.storage.retry)\n- [2.9.0](/python/docs/reference/storage/2.9.0/google.cloud.storage.retry)\n- [2.8.0](/python/docs/reference/storage/2.8.0/google.cloud.storage.retry)\n- [2.7.0](/python/docs/reference/storage/2.7.0/google.cloud.storage.retry)\n- [2.6.0](/python/docs/reference/storage/2.6.0/google.cloud.storage.retry)\n- [2.5.0](/python/docs/reference/storage/2.5.0/google.cloud.storage.retry)\n- [2.4.0](/python/docs/reference/storage/2.4.0/google.cloud.storage.retry)\n- [2.3.0](/python/docs/reference/storage/2.3.0/google.cloud.storage.retry)\n- [2.2.1](/python/docs/reference/storage/2.2.1/google.cloud.storage.retry)\n- [2.1.0](/python/docs/reference/storage/2.1.0/google.cloud.storage.retry)\n- [2.0.0](/python/docs/reference/storage/2.0.0/google.cloud.storage.retry)\n- [1.44.0](/python/docs/reference/storage/1.44.0/google.cloud.storage.retry)\n- [1.43.0](/python/docs/reference/storage/1.43.0/google.cloud.storage.retry)\n- [1.42.3](/python/docs/reference/storage/1.42.3/google.cloud.storage.retry)\n- [1.41.1](/python/docs/reference/storage/1.41.1/google.cloud.storage.retry)\n- [1.40.0](/python/docs/reference/storage/1.40.0/google.cloud.storage.retry)\n- [1.39.0](/python/docs/reference/storage/1.39.0/google.cloud.storage.retry)\n- [1.38.0](/python/docs/reference/storage/1.38.0/google.cloud.storage.retry)\n- [1.37.1](/python/docs/reference/storage/1.37.1/google.cloud.storage.retry)\n- [1.36.2](/python/docs/reference/storage/1.36.2/google.cloud.storage.retry)\n- [1.35.1](/python/docs/reference/storage/1.35.1/google.cloud.storage.retry)\n- [1.34.0](/python/docs/reference/storage/1.34.0/google.cloud.storage.retry)\n- [1.33.0](/python/docs/reference/storage/1.33.0/google.cloud.storage.retry)\n- [1.32.0](/python/docs/reference/storage/1.32.0/google.cloud.storage.retry)\n- [1.31.2](/python/docs/reference/storage/1.31.2/google.cloud.storage.retry)\n- [1.30.0](/python/docs/reference/storage/1.30.0/google.cloud.storage.retry)\n- [1.29.0](/python/docs/reference/storage/1.29.0/google.cloud.storage.retry)\n- [1.28.1](/python/docs/reference/storage/1.28.1/google.cloud.storage.retry)\n- [1.27.0](/python/docs/reference/storage/1.27.0/google.cloud.storage.retry)\n- [1.26.0](/python/docs/reference/storage/1.26.0/google.cloud.storage.retry)\n- [1.25.0](/python/docs/reference/storage/1.25.0/google.cloud.storage.retry)\n- [1.24.1](/python/docs/reference/storage/1.24.1/google.cloud.storage.retry)\n- [1.23.0](/python/docs/reference/storage/1.23.0/google.cloud.storage.retry)\n- [1.22.0](/python/docs/reference/storage/1.22.0/google.cloud.storage.retry)\n- [1.21.0](/python/docs/reference/storage/1.21.0/google.cloud.storage.retry)\n- [1.20.0](/python/docs/reference/storage/1.20.0/google.cloud.storage.retry)\n- [1.19.0](/python/docs/reference/storage/1.19.0/google.cloud.storage.retry)\n- [1.18.0](/python/docs/reference/storage/1.18.0/google.cloud.storage.retry)\n- [1.17.0](/python/docs/reference/storage/1.17.0/google.cloud.storage.retry) \nHelpers for configuring retries with exponential back-off.\n\nSee [Retry Strategy for Google Cloud Storage](https://cloud.google.com/storage/docs/retry-strategy#client-libraries)\n\nClasses\n-------\n\n### [ConditionalRetryPolicy](/python/docs/reference/storage/latest/google.cloud.storage.retry.ConditionalRetryPolicy)\n\n ConditionalRetryPolicy(retry_policy, conditional_predicate, required_kwargs)\n\nA class for use when an API call is only conditionally safe to retry.\n\nThis class is intended for use in inspecting the API call parameters of an\nAPI call to verify that any flags necessary to make the API call idempotent\n(such as specifying an `if_generation_match` or related flag) are present.\n\nIt can be used in place of a `retry.Retry` object, in which case\n`_http.Connection.api_request` will pass the requested api call keyword\narguments into the `conditional_predicate` and return the `retry_policy`\nif the conditions are met.\n\nModules\nFunctions\n-----------------\n\n### is_etag_in_data\n\n is_etag_in_data(data)\n\nReturn True if an etag is contained in the request body.\n\n### is_etag_in_json\n\n is_etag_in_json(data)\n\n`is_etag_in_json` is supported for backwards-compatibility reasons only;\nplease use `is_etag_in_data` instead.\n\n### is_generation_specified\n\n is_generation_specified(query_params)\n\nReturn True if generation or if_generation_match is specified.\n\n### is_metageneration_specified\n\n is_metageneration_specified(query_params)\n\nReturn True if if_metageneration_match is specified."]]