|CI| |Conda| |PyPI|
.. |CI| image:: https://github.com/iterative/PyDrive2/workflows/Tests/badge.svg?branch=main
:target: https://github.com/iterative/PyDrive2/actions
:alt: GHA Tests
.. |Conda| image:: https://img.shields.io/conda/v/conda-forge/PyDrive2.svg?label=conda&logo=conda-forge
:target: https://anaconda.org/conda-forge/PyDrive2
:alt: Conda-forge
.. |PyPI| image:: https://img.shields.io/pypi/v/PyDrive2.svg?label=pip&logo=PyPI&logoColor=white
:target: https://pypi.org/project/PyDrive2
:alt: PyPI
PyDrive2
--------
*PyDrive2* is a wrapper library of
`google-api-python-client <https://github.com/google/google-api-python-client>`_
that simplifies many common Google Drive API V2 tasks. It is an actively
maintained fork of `https://pypi.python.org/pypi/PyDrive <https://pypi.python.org/pypi/PyDrive>`_.
By the authors and maintainers of the `Git for Data <https://dvc.org>`_ - DVC
project.
Project Info
------------
- Package: `https://pypi.python.org/pypi/PyDrive2 <https://pypi.python.org/pypi/PyDrive2>`_
- Documentation: `https://docs.iterative.ai/PyDrive2 <https://docs.iterative.ai/PyDrive2>`_
- Source: `https://github.com/iterative/PyDrive2 <https://github.com/iterative/PyDrive2>`_
- Changelog: `https://github.com/iterative/PyDrive2/releases <https://github.com/iterative/PyDrive2/releases>`_
- `Running tests </pydrive2/test/README.rst>`_
Features of PyDrive2
--------------------
- Simplifies OAuth2.0 into just few lines with flexible settings.
- Wraps `Google Drive API V2 <https://developers.google.com/drive/v2/web/about-sdk>`_ into
classes of each resource to make your program more object-oriented.
- Helps common operations else than API calls, such as content fetching
and pagination control.
- Provides `fsspec`_ filesystem implementation.
How to install
--------------
You can install PyDrive2 with regular ``pip`` command.
::
$ pip install PyDrive2
To install the current development version from GitHub, use:
::
$ pip install git+https://github.com/iterative/PyDrive2.git#egg=PyDrive2
OAuth made easy
---------------
Download *client\_secrets.json* from Google API Console and OAuth2.0 is
done in two lines. You can customize behavior of OAuth2 in one settings
file *settings.yaml*.
.. code:: python
from pydrive2.auth import GoogleAuth
from pydrive2.drive import GoogleDrive
gauth = GoogleAuth()
gauth.LocalWebserverAuth()
drive = GoogleDrive(gauth)
File management made easy
-------------------------
Upload/update the file with one method. PyDrive2 will do it in the most
efficient way.
.. code:: python
file1 = drive.CreateFile({'title': 'Hello.txt'})
file1.SetContentString('Hello')
file1.Upload() # Files.insert()
file1['title'] = 'HelloWorld.txt' # Change title of the file
file1.Upload() # Files.patch()
content = file1.GetContentString() # 'Hello'
file1.SetContentString(content+' World!') # 'Hello World!'
file1.Upload() # Files.update()
file2 = drive.CreateFile()
file2.SetContentFile('hello.png')
file2.Upload()
print('Created file %s with mimeType %s' % (file2['title'],
file2['mimeType']))
# Created file hello.png with mimeType image/png
file3 = drive.CreateFile({'id': file2['id']})
print('Downloading file %s from Google Drive' % file3['title']) # 'hello.png'
file3.GetContentFile('world.png') # Save Drive file as a local file
# or download Google Docs files in an export format provided.
# downloading a docs document as an html file:
docsfile.GetContentFile('test.html', mimetype='text/html')
File listing pagination made easy
---------------------------------
*PyDrive2* handles file listing pagination for you.
.. code:: python
# Auto-iterate through all files that matches this query
file_list = drive.ListFile({'q': "'root' in parents"}).GetList()
for file1 in file_list:
print('title: {}, id: {}'.format(file1['title'], file1['id']))
# Paginate file lists by specifying number of max results
for file_list in drive.ListFile({'maxResults': 10}):
print('Received {} files from Files.list()'.format(len(file_list))) # <= 10
for file1 in file_list:
print('title: {}, id: {}'.format(file1['title'], file1['id']))
Fsspec filesystem
-----------------
*PyDrive2* provides easy way to work with your files through `fsspec`_
compatible `GDriveFileSystem`_.
Install PyDrive2 with the required dependencies
::
$ pip install PyDrive2[fsspec]
.. code:: python
from pydrive2.fs import GDriveFileSystem
# replace `root` with ID of a drive or directory and give service account access to it
fs = GDriveFileSystem("root", client_id=my_id, client_secret=my_secret)
for root, dnames, fnames in fs.walk("root"):
...
.. _`GDriveFileSystem`: https://docs.iterative.ai/PyDrive2/fsspec/
Concurrent access made easy
---------------------------
All API functions made to be thread-safe.
Contributors
------------
Thanks to all our contributors!
.. image:: https://contrib.rocks/image?repo=iterative/PyDrive2
:target: https://github.com/iterative/PyDrive2/graphs/contributors
.. _`fsspec`: https://filesystem-spec.readthedocs.io/en/latest/
Raw data
{
"_id": null,
"home_page": "https://github.com/iterative/PyDrive2",
"name": "PyDrive2",
"maintainer": "DVC team",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "support@dvc.org",
"keywords": null,
"author": "JunYoung Gwak",
"author_email": "jgwak@dreamylab.com",
"download_url": "https://files.pythonhosted.org/packages/3f/dc/92b0beba58f09441219bb6720bebdb895317632db4778cfe1d21532d27e5/pydrive2-1.21.3.tar.gz",
"platform": null,
"description": "|CI| |Conda| |PyPI|\n\n.. |CI| image:: https://github.com/iterative/PyDrive2/workflows/Tests/badge.svg?branch=main\n :target: https://github.com/iterative/PyDrive2/actions\n :alt: GHA Tests\n\n.. |Conda| image:: https://img.shields.io/conda/v/conda-forge/PyDrive2.svg?label=conda&logo=conda-forge\n :target: https://anaconda.org/conda-forge/PyDrive2\n :alt: Conda-forge\n\n.. |PyPI| image:: https://img.shields.io/pypi/v/PyDrive2.svg?label=pip&logo=PyPI&logoColor=white\n :target: https://pypi.org/project/PyDrive2\n :alt: PyPI\n\nPyDrive2\n--------\n\n*PyDrive2* is a wrapper library of\n`google-api-python-client <https://github.com/google/google-api-python-client>`_\nthat simplifies many common Google Drive API V2 tasks. It is an actively\nmaintained fork of `https://pypi.python.org/pypi/PyDrive <https://pypi.python.org/pypi/PyDrive>`_.\nBy the authors and maintainers of the `Git for Data <https://dvc.org>`_ - DVC\nproject.\n\nProject Info\n------------\n\n- Package: `https://pypi.python.org/pypi/PyDrive2 <https://pypi.python.org/pypi/PyDrive2>`_\n- Documentation: `https://docs.iterative.ai/PyDrive2 <https://docs.iterative.ai/PyDrive2>`_\n- Source: `https://github.com/iterative/PyDrive2 <https://github.com/iterative/PyDrive2>`_\n- Changelog: `https://github.com/iterative/PyDrive2/releases <https://github.com/iterative/PyDrive2/releases>`_\n- `Running tests </pydrive2/test/README.rst>`_\n\nFeatures of PyDrive2\n--------------------\n\n- Simplifies OAuth2.0 into just few lines with flexible settings.\n- Wraps `Google Drive API V2 <https://developers.google.com/drive/v2/web/about-sdk>`_ into\n classes of each resource to make your program more object-oriented.\n- Helps common operations else than API calls, such as content fetching\n and pagination control.\n- Provides `fsspec`_ filesystem implementation.\n\nHow to install\n--------------\n\nYou can install PyDrive2 with regular ``pip`` command.\n\n::\n\n $ pip install PyDrive2\n\nTo install the current development version from GitHub, use:\n\n::\n\n $ pip install git+https://github.com/iterative/PyDrive2.git#egg=PyDrive2\n\nOAuth made easy\n---------------\n\nDownload *client\\_secrets.json* from Google API Console and OAuth2.0 is\ndone in two lines. You can customize behavior of OAuth2 in one settings\nfile *settings.yaml*.\n\n.. code:: python\n\n\n from pydrive2.auth import GoogleAuth\n from pydrive2.drive import GoogleDrive\n\n gauth = GoogleAuth()\n gauth.LocalWebserverAuth()\n\n drive = GoogleDrive(gauth)\n\nFile management made easy\n-------------------------\n\nUpload/update the file with one method. PyDrive2 will do it in the most\nefficient way.\n\n.. code:: python\n\n file1 = drive.CreateFile({'title': 'Hello.txt'})\n file1.SetContentString('Hello')\n file1.Upload() # Files.insert()\n\n file1['title'] = 'HelloWorld.txt' # Change title of the file\n file1.Upload() # Files.patch()\n\n content = file1.GetContentString() # 'Hello'\n file1.SetContentString(content+' World!') # 'Hello World!'\n file1.Upload() # Files.update()\n\n file2 = drive.CreateFile()\n file2.SetContentFile('hello.png')\n file2.Upload()\n print('Created file %s with mimeType %s' % (file2['title'],\n file2['mimeType']))\n # Created file hello.png with mimeType image/png\n\n file3 = drive.CreateFile({'id': file2['id']})\n print('Downloading file %s from Google Drive' % file3['title']) # 'hello.png'\n file3.GetContentFile('world.png') # Save Drive file as a local file\n\n # or download Google Docs files in an export format provided.\n # downloading a docs document as an html file:\n docsfile.GetContentFile('test.html', mimetype='text/html')\n\nFile listing pagination made easy\n---------------------------------\n\n*PyDrive2* handles file listing pagination for you.\n\n.. code:: python\n\n # Auto-iterate through all files that matches this query\n file_list = drive.ListFile({'q': \"'root' in parents\"}).GetList()\n for file1 in file_list:\n print('title: {}, id: {}'.format(file1['title'], file1['id']))\n\n # Paginate file lists by specifying number of max results\n for file_list in drive.ListFile({'maxResults': 10}):\n print('Received {} files from Files.list()'.format(len(file_list))) # <= 10\n for file1 in file_list:\n print('title: {}, id: {}'.format(file1['title'], file1['id']))\n\nFsspec filesystem\n-----------------\n\n*PyDrive2* provides easy way to work with your files through `fsspec`_\ncompatible `GDriveFileSystem`_.\n\nInstall PyDrive2 with the required dependencies\n\n::\n\n $ pip install PyDrive2[fsspec]\n\n.. code:: python\n\n from pydrive2.fs import GDriveFileSystem\n\n # replace `root` with ID of a drive or directory and give service account access to it\n fs = GDriveFileSystem(\"root\", client_id=my_id, client_secret=my_secret)\n\n for root, dnames, fnames in fs.walk(\"root\"):\n ...\n\n.. _`GDriveFileSystem`: https://docs.iterative.ai/PyDrive2/fsspec/\n\nConcurrent access made easy\n---------------------------\n\nAll API functions made to be thread-safe.\n\nContributors\n------------\n\nThanks to all our contributors!\n\n.. image:: https://contrib.rocks/image?repo=iterative/PyDrive2\n :target: https://github.com/iterative/PyDrive2/graphs/contributors\n\n.. _`fsspec`: https://filesystem-spec.readthedocs.io/en/latest/\n",
"bugtrack_url": null,
"license": "Apache License 2.0",
"summary": "Google Drive API made easy. Maintained fork of PyDrive.",
"version": "1.21.3",
"project_urls": {
"Changelog": "https://github.com/iterative/PyDrive2/releases",
"Documentation": "https://docs.iterative.ai/PyDrive2",
"Homepage": "https://github.com/iterative/PyDrive2"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8cdeeef2e2661371b02d4231c5cacbb758a52ea9ea98cb5f52d69298641e2631",
"md5": "62d089356c9b6e0817cd6f2739e2aa3a",
"sha256": "843a304f500e71508162807001f5e19487f272e8ff5648f43582bd24c6250200"
},
"downloads": -1,
"filename": "PyDrive2-1.21.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "62d089356c9b6e0817cd6f2739e2aa3a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 47972,
"upload_time": "2024-11-29T09:49:51",
"upload_time_iso_8601": "2024-11-29T09:49:51.254281Z",
"url": "https://files.pythonhosted.org/packages/8c/de/eef2e2661371b02d4231c5cacbb758a52ea9ea98cb5f52d69298641e2631/PyDrive2-1.21.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3fdc92b0beba58f09441219bb6720bebdb895317632db4778cfe1d21532d27e5",
"md5": "ff7e5535054bd2ab9df7d77c5a49f6ed",
"sha256": "649b84d60c637bc7146485039535aa8f1254ad156423739f07e5d32507447c13"
},
"downloads": -1,
"filename": "pydrive2-1.21.3.tar.gz",
"has_sig": false,
"md5_digest": "ff7e5535054bd2ab9df7d77c5a49f6ed",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 63348,
"upload_time": "2024-11-29T09:49:53",
"upload_time_iso_8601": "2024-11-29T09:49:53.556842Z",
"url": "https://files.pythonhosted.org/packages/3f/dc/92b0beba58f09441219bb6720bebdb895317632db4778cfe1d21532d27e5/pydrive2-1.21.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-29 09:49:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "iterative",
"github_project": "PyDrive2",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "pydrive2"
}