summaryrefslogtreecommitdiffstats
path: root/contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2025-04-29 13:13:02 +0300
committerrobot-piglet <[email protected]>2025-04-29 13:30:37 +0300
commit43c48235ff779855489561438e0ba08bd8dfb4fc (patch)
tree38288f51b582424c1fc554aab78a5e27f303d72a /contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py
parent46634855c4eebcbf9416afe1bd0448058aa40373 (diff)
Intermediate changes
commit_hash:8152cafb3d167774615b4df5bf4470b6269e88a7
Diffstat (limited to 'contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py')
-rw-r--r--contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py b/contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py
index 06f99de0e2c..ddbe8ac2f70 100644
--- a/contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py
+++ b/contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py
@@ -159,6 +159,7 @@ def get(
retry_count=5,
headers=None,
return_none_for_not_found_error=False,
+ timeout=_METADATA_DEFAULT_TIMEOUT,
):
"""Fetch a resource from the metadata server.
@@ -178,6 +179,7 @@ def get(
headers (Optional[Mapping[str, str]]): Headers for the request.
return_none_for_not_found_error (Optional[bool]): If True, returns None
for 404 error instead of throwing an exception.
+ timeout (int): How long to wait, in seconds for the metadata server to respond.
Returns:
Union[Mapping, str]: If the metadata server returns JSON, a mapping of
@@ -204,7 +206,9 @@ def get(
failure_reason = None
for attempt in backoff:
try:
- response = request(url=url, method="GET", headers=headers_to_use)
+ response = request(
+ url=url, method="GET", headers=headers_to_use, timeout=timeout
+ )
if response.status in transport.DEFAULT_RETRYABLE_STATUS_CODES:
_LOGGER.warning(
"Compute Engine Metadata server unavailable on "