コード例 #1
0
    def client(self):
        try:
            from gdrivefs import GoogleDriveFileSystem
        except ImportError:
            pytest.skip("gdrivefs is not installed")

        return GoogleDriveFileSystem(
            token="cache",
            tokens_file=self.config["gdrive_service_account_json_file_path"],
            service_account=self.config["gdrive_use_service_account"],
        )
コード例 #2
0
ファイル: gdrive.py プロジェクト: phdtanvir/dvc
    def client(self):
        import pydata_google_auth
        from gdrivefs import GoogleDriveFileSystem

        tmp_path = tmp_fname()
        with open(tmp_path, "w") as stream:
            stream.write(os.getenv(GDriveFileSystem.GDRIVE_CREDENTIALS_DATA))

        GoogleDriveFileSystem._connect_cache = partial(
            pydata_google_auth.load_user_credentials, tmp_path)
        return GoogleDriveFileSystem(token="cache")