leaf_engine.io.gdrive.upload

Functions

upload_to_drive(→ str)

Uploads file to Google Drive.

Module Contents

leaf_engine.io.gdrive.upload.upload_to_drive(local_path: str | pathlib.Path, drive_path: str, overwrite: bool = False) str

Uploads file to Google Drive.

Parameters:
  • local_path (Union[str, Path]) – Local path of file to upload.

  • drive_path (str) – Google Drive path to uploaded to. First part of path is the drive name. Must include file name: “drive_name/folder1/folder2/file_name.zip”.

  • overwrite (bool) – Overwrite existing file. Defaults to False.

Raises:
  • LeafGoogleDriveException – Raised if overwrite is False and file exists.

  • LeafGoogleDriveException – Raised if unable to upload file.

Returns:

Google Drive URL of uploaded file.

Return type:

str