summaryrefslogtreecommitdiffstats
path: root/contrib/python/google-auth/py3/google/auth/_default.py
diff options
context:
space:
mode:
authorYDBot <[email protected]>2025-10-20 12:59:43 +0000
committerYDBot <[email protected]>2025-10-20 12:59:43 +0000
commit7874efeb56a4beed3df6a5a5a413dc6583d23e7a (patch)
treeddd3dc43ad00a7ea058cf35070b98e5d6475fdbb /contrib/python/google-auth/py3/google/auth/_default.py
parentb0dc87f6d3013af373dfd9a5c670acd18ea1dbe6 (diff)
parent14e27f7771734f0b5d08cb303cc469bf64d6c772 (diff)
Merge pull request #26940 from ydb-platform/merge-rightlib-251016-0050
Diffstat (limited to 'contrib/python/google-auth/py3/google/auth/_default.py')
-rw-r--r--contrib/python/google-auth/py3/google/auth/_default.py29
1 files changed, 17 insertions, 12 deletions
diff --git a/contrib/python/google-auth/py3/google/auth/_default.py b/contrib/python/google-auth/py3/google/auth/_default.py
index 2df2b4e02b6..a96f7108be2 100644
--- a/contrib/python/google-auth/py3/google/auth/_default.py
+++ b/contrib/python/google-auth/py3/google/auth/_default.py
@@ -305,15 +305,17 @@ def _get_gcloud_sdk_credentials(quota_project_id=None):
_LOGGER.debug("Cloud SDK credentials not found on disk; not using them")
return None, None
- credentials, project_id = load_credentials_from_file(
- credentials_filename, quota_project_id=quota_project_id
- )
- credentials._cred_file_path = credentials_filename
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore", DeprecationWarning)
+ credentials, project_id = load_credentials_from_file(
+ credentials_filename, quota_project_id=quota_project_id
+ )
+ credentials._cred_file_path = credentials_filename
- if not project_id:
- project_id = _cloud_sdk.get_project_id()
+ if not project_id:
+ project_id = _cloud_sdk.get_project_id()
- return credentials, project_id
+ return credentials, project_id
def _get_explicit_environ_credentials(quota_project_id=None):
@@ -339,12 +341,15 @@ def _get_explicit_environ_credentials(quota_project_id=None):
return _get_gcloud_sdk_credentials(quota_project_id=quota_project_id)
if explicit_file is not None:
- credentials, project_id = load_credentials_from_file(
- os.environ[environment_vars.CREDENTIALS], quota_project_id=quota_project_id
- )
- credentials._cred_file_path = f"{explicit_file} file via the GOOGLE_APPLICATION_CREDENTIALS environment variable"
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore", DeprecationWarning)
+ credentials, project_id = load_credentials_from_file(
+ os.environ[environment_vars.CREDENTIALS],
+ quota_project_id=quota_project_id,
+ )
+ credentials._cred_file_path = f"{explicit_file} file via the GOOGLE_APPLICATION_CREDENTIALS environment variable"
- return credentials, project_id
+ return credentials, project_id
else:
return None, None