MCPcopy Index your code
hub / github.com/Kaggle/docker-python / get_gcloud_credential

Method get_gcloud_credential

patches/kaggle_secrets.py:70–84  ·  view source on GitHub ↗

Retrieves the Google Cloud SDK credential attached to the current kernel. Example usage: client = UserSecretsClient() credential_json = client.get_gcloud_credential()

(self)

Source from the content-addressed store, hash-verified

68 return response_json['secret']
69
70 def get_gcloud_credential(self) -> str:
71 """Retrieves the Google Cloud SDK credential attached to the current
72 kernel.
73 Example usage:
74 client = UserSecretsClient()
75 credential_json = client.get_gcloud_credential()
76 """
77 try:
78 return self.get_secret("__gcloud_sdk_auth__")
79 except BackendError as backend_error:
80 message = str(backend_error.args)
81 if message.find('No user secrets exist') != -1:
82 raise NotFoundError('Google Cloud SDK credential not found.')
83 else:
84 raise
85
86 def set_gcloud_credentials(self, project=None, account=None):
87 """Set user credentials attached to the current kernel and optionally the project & account name to the `gcloud` CLI.

Callers 3

call_get_secretMethod · 0.95
test_fnMethod · 0.95

Calls 2

get_secretMethod · 0.95
NotFoundErrorClass · 0.85

Tested by 2

call_get_secretMethod · 0.76
test_fnMethod · 0.76