From 71fcf5a089a134cf57cff41d72bd303f9e8d45bc Mon Sep 17 00:00:00 2001 From: "Chu-An, Huang" Date: Thu, 1 Feb 2024 23:02:04 +0800 Subject: [PATCH] fix: Correct the path of service account in google drive settings (#123) * fix: Correct the path of service account in yaml file * fix: Remove redefined function * Update src/auto_archiver/storages/gd.py * fix: remove unwanted drafting code --------- Co-authored-by: Miguel Sozinho Ramalho <19508417+msramalho@users.noreply.github.com> --- src/auto_archiver/storages/gd.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/auto_archiver/storages/gd.py b/src/auto_archiver/storages/gd.py index ccf3e63..61c5b21 100644 --- a/src/auto_archiver/storages/gd.py +++ b/src/auto_archiver/storages/gd.py @@ -52,7 +52,7 @@ class GDriveStorage(Storage): else: logger.debug('GD OAuth Token valid') else: - gd_service_account = config.service_account + gd_service_account = self.service_account logger.debug(f'Using GD Service Account {gd_service_account}') creds = service_account.Credentials.from_service_account_file(gd_service_account, scopes=SCOPES) @@ -87,15 +87,6 @@ class GDriveStorage(Storage): file_id = self._get_id_from_parent_and_name(folder_id, filename) return f"https://drive.google.com/file/d/{file_id}/view?usp=sharing" - def upload(self, media: Media, **kwargs) -> bool: - # override parent so that we can use shutil.copy2 and keep metadata - dest = os.path.join(self.save_to, media.key) - os.makedirs(os.path.dirname(dest), exist_ok=True) - logger.debug(f'[{self.__class__.name}] storing file {media.filename} with key {media.key} to {dest}') - res = shutil.copy2(media.filename, dest) - logger.info(res) - return True - def upload(self, media: Media, **kwargs) -> bool: logger.debug(f'[{self.__class__.name}] storing file {media.filename} with key {media.key}') """