@@ -305,15 +305,17 @@ def _get_gcloud_sdk_credentials(quota_project_id=None):
305305 _LOGGER .debug ("Cloud SDK credentials not found on disk; not using them" )
306306 return None , None
307307
308- credentials , project_id = load_credentials_from_file (
309- credentials_filename , quota_project_id = quota_project_id
310- )
311- credentials ._cred_file_path = credentials_filename
308+ with warnings .catch_warnings ():
309+ warnings .simplefilter ("ignore" , DeprecationWarning )
310+ credentials , project_id = load_credentials_from_file (
311+ credentials_filename , quota_project_id = quota_project_id
312+ )
313+ credentials ._cred_file_path = credentials_filename
312314
313- if not project_id :
314- project_id = _cloud_sdk .get_project_id ()
315+ if not project_id :
316+ project_id = _cloud_sdk .get_project_id ()
315317
316- return credentials , project_id
318+ return credentials , project_id
317319
318320
319321def _get_explicit_environ_credentials (quota_project_id = None ):
@@ -339,12 +341,15 @@ def _get_explicit_environ_credentials(quota_project_id=None):
339341 return _get_gcloud_sdk_credentials (quota_project_id = quota_project_id )
340342
341343 if explicit_file is not None :
342- credentials , project_id = load_credentials_from_file (
343- os .environ [environment_vars .CREDENTIALS ], quota_project_id = quota_project_id
344- )
345- credentials ._cred_file_path = f"{ explicit_file } file via the GOOGLE_APPLICATION_CREDENTIALS environment variable"
344+ with warnings .catch_warnings ():
345+ warnings .simplefilter ("ignore" , DeprecationWarning )
346+ credentials , project_id = load_credentials_from_file (
347+ os .environ [environment_vars .CREDENTIALS ],
348+ quota_project_id = quota_project_id ,
349+ )
350+ credentials ._cred_file_path = f"{ explicit_file } file via the GOOGLE_APPLICATION_CREDENTIALS environment variable"
346351
347- return credentials , project_id
352+ return credentials , project_id
348353
349354 else :
350355 return None , None
0 commit comments