Skip to content

Commit

Permalink
fs: gdrive: upgrade pydrive2 to 1.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
efiop committed Jul 18, 2022
1 parent 680ac29 commit 3c0ec88
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ azure =
adlfs>=2021.10.0
azure-identity>=1.4.0
knack
gdrive = pydrive2[fsspec]>=1.11.2
gdrive = pydrive2[fsspec]>=1.12.0
gs = gcsfs>=2021.11.1
hdfs =
# due to https://github.com/python-poetry/poetry/issues/4683, we have to
Expand Down
17 changes: 5 additions & 12 deletions src/dvc_objects/fs/implementations/gdrive.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ def _validate_credentials(auth, settings):
@wrap_prop(threading.RLock())
@cached_property
def fs(self):
import json

from pydrive2.auth import GoogleAuth
from pydrive2.fs import GDriveFileSystem as _GDriveFileSystem

Expand All @@ -174,15 +172,10 @@ def fs(self):
],
}

env_creds_json = os.getenv(self.GDRIVE_CREDENTIALS_DATA)
try:
env_creds_dict = json.loads(env_creds_json)
except ValueError as exc:
raise GDriveAuthError(self.GDRIVE_CREDENTIALS_DATA) from exc

if env_creds_json:
env_creds = os.getenv(self.GDRIVE_CREDENTIALS_DATA)
if env_creds:
auth_settings["save_credentials_backend"] = "dictionary"
auth_settings["save_credentials_dict"] = {"creds": env_creds_json}
auth_settings["save_credentials_dict"] = {"creds": env_creds}
auth_settings["save_credentials_key"] = "creds"
else:
auth_settings["save_credentials_backend"] = "file"
Expand All @@ -195,8 +188,8 @@ def fs(self):
"client_user_email": self._service_account_user_email,
}

if env_creds_dict:
service_config["client_creds_dict"] = env_creds_dict
if env_creds:
service_config["client_json"] = env_creds
else:
service_config[
"client_json_file_path"
Expand Down

0 comments on commit 3c0ec88

Please sign in to comment.