Skip to main content

The Python package google drive facilitates access to files uploaded to Google Drive.

Project description

Google-Driver

YouTuber Pypi Version Contributor Covenant Python Version Code convention Black Fomatter

The Google-Driver Python package simplifies downloading files and folders from Google Drive, with some constraints for model management through Hugging-Face and Git-Lfs. Issues may arise due to too many files, access permissions, or large file sizes. Be cautious with large files as they may contain viruses. The gdown package offers better exception handling and compatibility.


Installation

pip install googledriver

Features

1. File Download

Download to specific path
To save a file from a shared Google Drive URL to local storage, use the following code.

from googledriver import download

URL = 'https://drive.google.com/file/d/xxxxxxxxx/view?usp=share_link'
download(URL, './model/tf_gpt2_model')

Download to cached folder
To download a cached file (or directory) from a URL and return its path, you can use the following method.

from googledriver import download

URL = 'https://drive.google.com/file/d/xxxxxxxxx/view?usp=share_link'
cached_path = download(URL, None, 'tf_model')

Basically, torch cached is used, and the huggingface hub module is used as a reference and wrapped.


2. Folder Download

The return value returns the path of the saved files. However, it is different when using it as a cache folder.

Download to current working directory

from googledriver import download_folder

URL = 'https://drive.google.com/file/d/xxxxxxxxx/view?usp=share_link'

download_folder(URL)

Download to specific directory

from googledriver import download_folder

URL = 'https://drive.google.com/file/d/xxxxxxxxx/view?usp=share_link'
save_folder = './any/path/to/save/'

download_folder(URL, save_folder)

Download to cached directory

from googledriver import download_folder

URL = 'https://drive.google.com/file/d/xxxxxxxxx/view?usp=share_link'

download_folder(URL, cached=True)

In the case of the cache folder, the return value is the cache folder path of Google Drive. Therefore, it may be difficult to cache and use multiple folders.


References

[1] https://github.com/huggingface/transformers
[2] https://github.com/wkentaro/gdown

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

googledriver-0.1.7.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

googledriver-0.1.7-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file googledriver-0.1.7.tar.gz.

File metadata

  • Download URL: googledriver-0.1.7.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.25.1 requests-toolbelt/0.10.1 urllib3/1.26.4 tqdm/4.64.1 importlib-metadata/4.6.4 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.7

File hashes

Hashes for googledriver-0.1.7.tar.gz
Algorithm Hash digest
SHA256 05faa5c06ad6220696dc1b4ca71dd0938dd6eb107bf2c096d449b580e67b0401
MD5 fbe85dab5698fba2c5824dc2f8db38e5
BLAKE2b-256 472d8069147171acdd2deb2f4904492abb1a95497796c34f6bb63c4ddbb5b40f

See more details on using hashes here.

File details

Details for the file googledriver-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: googledriver-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 20.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.25.1 requests-toolbelt/0.10.1 urllib3/1.26.4 tqdm/4.64.1 importlib-metadata/4.6.4 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.7

File hashes

Hashes for googledriver-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 5f9ebd4ea42ec21148a68a4e890314219917f90f3879f47226793a8ef1764e47
MD5 62e3f78019e60b8dbb0373cc94bdb050
BLAKE2b-256 e17584f28695a9bda28624f84933bf44006df143b834ac1e60a16143caaa1a83

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page