kopia lustrzana https://github.com/bellingcat/auto-archiver
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>pull/128/head
rodzic
590d3fe824
commit
71fcf5a089
|
@ -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}')
|
||||
"""
|
||||
|
|
Ładowanie…
Reference in New Issue