# Google-Driver
![YouTuber](https://img.shields.io/badge/pypi-googledriver-blue)
![Pypi Version](https://img.shields.io/pypi/v/googledriver.svg)
[![Contributor Covenant](https://img.shields.io/badge/contributor%20covenant-v2.0%20adopted-black.svg)](code_of_conduct.md)
[![Python Version](https://img.shields.io/badge/python-3.6%2C3.7%2C3.8-black.svg)](code_of_conduct.md)
![Code convention](https://img.shields.io/badge/code%20convention-pep8-black)
![Black Fomatter](https://img.shields.io/badge/code%20style-black-000000.svg)
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.
<br>
# Installation
```
pip install googledriver
```
<br>
# Features
## 1. File Download
`Download to specific path` <br>
To save a file from a shared Google Drive URL to local storage, use the following code.
```python
from googledriver import download
URL = 'https://drive.google.com/file/d/xxxxxxxxx/view?usp=share_link'
download(URL, './model/tf_gpt2_model')
```
<br>
`Download to cached folder` <br>
To download a cached file (or directory) from a URL and return its path, you can use the following method.
```python
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.
<br>
## 2. Folder Download
The return value returns the path of the saved files. However, it is different when using it as a cache folder. <br><br>
`Download to current working directory` <br>
```python
from googledriver import download_folder
URL = 'https://drive.google.com/file/d/xxxxxxxxx/view?usp=share_link'
download_folder(URL)
```
<Br>
`Download to specific directory` <br>
```python
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)
```
<br>
`Download to cached directory` <br>
```python
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.
<br>
# References
[1] https://github.com/huggingface/transformers <br>
[2] https://github.com/wkentaro/gdown
Raw data
{
"_id": null,
"home_page": "https://github.com/DSDanielPark/google-driver",
"name": "googledriver",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "Download,Googledrive",
"author": "parkminwoo",
"author_email": "parkminwoo1991@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/47/2d/8069147171acdd2deb2f4904492abb1a95497796c34f6bb63c4ddbb5b40f/googledriver-0.1.7.tar.gz",
"platform": null,
"description": "# Google-Driver\n![YouTuber](https://img.shields.io/badge/pypi-googledriver-blue)\n![Pypi Version](https://img.shields.io/pypi/v/googledriver.svg)\n[![Contributor Covenant](https://img.shields.io/badge/contributor%20covenant-v2.0%20adopted-black.svg)](code_of_conduct.md)\n[![Python Version](https://img.shields.io/badge/python-3.6%2C3.7%2C3.8-black.svg)](code_of_conduct.md)\n![Code convention](https://img.shields.io/badge/code%20convention-pep8-black)\n![Black Fomatter](https://img.shields.io/badge/code%20style-black-000000.svg)\n\nThe `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.\n\n<br>\n\n\n# Installation\n```\npip install googledriver\n```\n\n<br>\n\n# Features\n## 1. File Download\n`Download to specific path` <br>\nTo save a file from a shared Google Drive URL to local storage, use the following code.\n```python\nfrom googledriver import download\n\nURL = 'https://drive.google.com/file/d/xxxxxxxxx/view?usp=share_link'\ndownload(URL, './model/tf_gpt2_model')\n```\n\n<br>\n\n`Download to cached folder` <br>\nTo download a cached file (or directory) from a URL and return its path, you can use the following method.\n\n```python\nfrom googledriver import download\n\nURL = 'https://drive.google.com/file/d/xxxxxxxxx/view?usp=share_link'\ncached_path = download(URL, None, 'tf_model')\n```\nBasically, torch cached is used, and the huggingface hub module is used as a reference and wrapped.\n\n<br>\n\n## 2. Folder Download\nThe return value returns the path of the saved files. However, it is different when using it as a cache folder. <br><br>\n`Download to current working directory` <br>\n```python\nfrom googledriver import download_folder\n\nURL = 'https://drive.google.com/file/d/xxxxxxxxx/view?usp=share_link'\n\ndownload_folder(URL)\n```\n<Br>\n\n`Download to specific directory` <br>\n```python\nfrom googledriver import download_folder\n\nURL = 'https://drive.google.com/file/d/xxxxxxxxx/view?usp=share_link'\nsave_folder = './any/path/to/save/'\n\ndownload_folder(URL, save_folder)\n```\n\n<br>\n\n`Download to cached directory` <br>\n```python\nfrom googledriver import download_folder\n\nURL = 'https://drive.google.com/file/d/xxxxxxxxx/view?usp=share_link'\n\ndownload_folder(URL, cached=True)\n```\nIn 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.\n\n\n<br>\n\n# References\n[1] https://github.com/huggingface/transformers <br>\n[2] https://github.com/wkentaro/gdown\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "The Python package google drive facilitates access to files uploaded to Google Drive.",
"version": "0.1.7",
"split_keywords": [
"download",
"googledrive"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e17584f28695a9bda28624f84933bf44006df143b834ac1e60a16143caaa1a83",
"md5": "62e3f78019e60b8dbb0373cc94bdb050",
"sha256": "5f9ebd4ea42ec21148a68a4e890314219917f90f3879f47226793a8ef1764e47"
},
"downloads": -1,
"filename": "googledriver-0.1.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "62e3f78019e60b8dbb0373cc94bdb050",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 20937,
"upload_time": "2023-04-04T07:49:14",
"upload_time_iso_8601": "2023-04-04T07:49:14.363354Z",
"url": "https://files.pythonhosted.org/packages/e1/75/84f28695a9bda28624f84933bf44006df143b834ac1e60a16143caaa1a83/googledriver-0.1.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "472d8069147171acdd2deb2f4904492abb1a95497796c34f6bb63c4ddbb5b40f",
"md5": "fbe85dab5698fba2c5824dc2f8db38e5",
"sha256": "05faa5c06ad6220696dc1b4ca71dd0938dd6eb107bf2c096d449b580e67b0401"
},
"downloads": -1,
"filename": "googledriver-0.1.7.tar.gz",
"has_sig": false,
"md5_digest": "fbe85dab5698fba2c5824dc2f8db38e5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 18803,
"upload_time": "2023-04-04T07:49:16",
"upload_time_iso_8601": "2023-04-04T07:49:16.213494Z",
"url": "https://files.pythonhosted.org/packages/47/2d/8069147171acdd2deb2f4904492abb1a95497796c34f6bb63c4ddbb5b40f/googledriver-0.1.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-04 07:49:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "DSDanielPark",
"github_project": "google-driver",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "googledriver"
}