download_from_google

download_from_google(file_id, path, force=True, clean_on_failure=True, hexdigests=None)[source]

Download a file from google drive.

Implementation inspired by https://github.com/ndrplz/google-drive-downloader.

Parameters:
  • file_id (str) – The google file identifier

  • path (Union[str, Path]) – The place to write the file

  • force (bool) – If false and the file already exists, will not re-download.

  • clean_on_failure (bool) – If true, will delete the file on any exception raised during download

  • hexdigests (Optional[Mapping[str, str]]) – The expected hexdigests as (algorithm_name, expected_hex_digest) pairs.

Raises:
  • Exception – Thrown if an error besides a keyboard interrupt is thrown during download

  • KeyboardInterrupt – If a keyboard interrupt is thrown during download

  • UnexpectedDirectory – If a directory is given for the path argument

Return type:

None