From 8c70958382de1a192a54ba65ddebdfe703e061e0 Mon Sep 17 00:00:00 2001 From: Vincent Roseberry Date: Wed, 29 Nov 2023 16:44:50 -0800 Subject: [PATCH] Do not set gsutil credentials. (#1330) User accounts credentials are no longer supported by `gsutil`. The recommendation is to use `gcloud storage` instead. See full details in bug. We will add a script tip in the notebook editor to tell users using `gsutil` to use `gcloud storage` instead. http://b/313996272 --- patches/kaggle_secrets.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/patches/kaggle_secrets.py b/patches/kaggle_secrets.py index c1c5dc99..0bb97a03 100644 --- a/patches/kaggle_secrets.py +++ b/patches/kaggle_secrets.py @@ -94,7 +94,6 @@ def set_gcloud_credentials(self, project=None, account=None): """ creds = self.get_gcloud_credential() creds_path = self._write_credentials_file(creds) - self._write_gsutil_credentials_file(creds) subprocess.run(['gcloud', 'config', 'set', 'auth/credential_file_override', creds_path]) @@ -139,17 +138,6 @@ def _write_credentials_file(self, credentials) -> str: return adc_path - def _write_gsutil_credentials_file(self, credentials) -> str: - import json - creds_dict = json.loads(credentials) - boto_path = os.path.join(os.environ.get('HOME', '/'), '.boto') - with open(boto_path, 'w') as f: - f.write('[Credentials]\n') - f.write(' gs_oauth2_refresh_token = ') - f.write(creds_dict['refresh_token']) - - return boto_path - def _get_gcs_access_token(self) -> Tuple[str, Optional[datetime]]: return self._get_access_token(GcpTarget.GCS)