{ "info": { "author": "Baptiste Fontaine", "author_email": "baptiste.fontaine@oscaro.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# Drive\n\nGoogle Drive client.\n\n## Usage\n\nThe API exposes a client as `drive.client.Client` that manipulates instances of\n`drive.files.File`. A `File` represent a Google Drive file. Note that both\nregular files and directories are represented as `File`s, and a file can have\nmultiple parent directories. You can check if a `File` is a directory using the\n`is_directory` attribute.\n\nNote: \"Folder\" is just a synonym for \"Directory\".\n\n### Client\n\nHigh-level `Client` methods:\n\n* `get_file(file_id)` (`File`)\n* `get_file_by_name(name)` (`File`)\n* `files_shared_with_me()` (`File` list)\n* `get_shared_directory(name)` (`File`)\n* `root()` (`File`)\n* `upload_file(parent, path[, name])`: Upload a file\n* `upload_excel_workbook(parent, name, workbook)`: Upload an `openpyxl`\n workbook in a Google spreadsheet under `parent` with the name `name`.\n\nThe client also exposes low-level methods that work on file ids.\n\n### File\n\n* `id` (`str`, attribute)\n* `name` (`str`, attribute)\n* `is_directory` (`bool`, attribute)\n* `human_type` (`str`, attribute): Human-readable file type\n* `exists()` (`bool`)\n* `unlink()` (`bool`): Remove the file. If it's a directory, all its children\n are removed as well\n* `rename(new_name)`: Rename the file\n* `move_in(new_parent[, new_name])`: Move a file under another directory. It\n can also rename the file at the same time.\n* `list()`: List a directory\u2019s content\n* `create_folder(name)`: Create a folder under the current one\n* `get_or_create_folder(name)`: Retrieve a child folder or create it if it\n doesn\u2019t exist\n* `get_child(name)`: Return a file under the current directory.\n* `parents()`: Return a file's parents\n* `parent()`: Return the first parent of a file\n* `download_file(path[, mime_type])`: Download the file at a given location\n* `download_workbook()`: Download the file as an `openpyxl` workbook\n* `json()`: Parse the file as JSON\n* `jsons()`: Parse the file as JSONS (one JSON per line) and returns a generator\n\nMethods that operate on directories (e.g. `list()`) generally have no effect if\nthe `File` instance is a regular file.\n\n### Examples\n\n```python\nfrom drive.client import Client\n\n# Uses credentials from the path in the environment variable\n# GOOGLE_APPLICATION_CREDENTIALS.\ncl = Client()\n\n# Get the root directory\nd = cl.root()\nprint(d.is_directory) # True\nprint(d.name) # e.g. \"My Drive\"\n\n# Get a directory's content\nfor f in d.list():\n print(f.name)\n\n# Get a shared directory\nd = cl.get_shared_directory(\"My Shared Dir\")\n```\n\n#### Spreadsheets\n\n```python\ncl = Client()\n\n# Download\nf = cl.get_file_by_name(\"my_sheet\")\nworkbook = f.download_workbook() # readonly openpyxl workbook\n\n# Upload\nworkbook = Workbook()\nd = cl.get_shared_directory(\"My Shared Directory\")\ncl.upload_excel_workbook(d, \"my_other_sheet\", workbook)\n```\n\n#### Drawings\n\n```python\ncl = Client()\n# download a Drawing in a png image\ncl.download_file(\"11AASomeFileId\", \"localfile.png\", \"image/png\")\n```\n\n## License\n\nCopyright \u00a9 2016-2019 Oscaro.com\n\nDistributed under the MIT License.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/oscaro/drive", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "drive", "package_url": "https://pypi.org/project/drive/", "platform": "", "project_url": "https://pypi.org/project/drive/", "project_urls": { "Homepage": "https://github.com/oscaro/drive" }, "release_url": "https://pypi.org/project/drive/0.2.0/", "requires_dist": [ "datatypes (==0.1.0)", "google-api-python-client (==1.5.3)", "httplib2 (==0.9.2)", "oauth2client (==3.0.0)", "openpyxl (==2.4.0)", "pyasn1 (==0.1.9)", "pyasn1-modules (==0.0.8)", "python-magic (==0.4.12)", "rsa (==3.4.2)", "simplejson (==3.8.2)", "six (==1.10.0)", "uritemplate (==0.6)" ], "requires_python": "", "summary": "Google Drive client", "version": "0.2.0" }, "last_serial": 5649652, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "52d0b52d751cfc15cec85156d8628455", "sha256": "f8663c2a0af09e96f6e5e6d0a6b77f84b4fc62c16f1bb6f0a71bf03cf29da952" }, "downloads": -1, "filename": "drive-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "52d0b52d751cfc15cec85156d8628455", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10172, "upload_time": "2019-08-08T11:41:55", "url": "https://files.pythonhosted.org/packages/ed/84/fcc55772e8b9ecbb67baf1b395d512a0e6492bb2c34abeb6b3345dacd274/drive-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d78cb104ec19c16a17e81b5a42104af2", "sha256": "6da17943ebc25763b28e0fcd6fa20312bb057efd4153f4dd3bb5006cfee125c0" }, "downloads": -1, "filename": "drive-0.2.0.tar.gz", "has_sig": false, "md5_digest": "d78cb104ec19c16a17e81b5a42104af2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9382, "upload_time": "2019-08-08T11:41:57", "url": "https://files.pythonhosted.org/packages/57/3f/4e492bf1796a575c751ea8e9aae1a94fad2f390f53535c411eecc9ec9a6e/drive-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "52d0b52d751cfc15cec85156d8628455", "sha256": "f8663c2a0af09e96f6e5e6d0a6b77f84b4fc62c16f1bb6f0a71bf03cf29da952" }, "downloads": -1, "filename": "drive-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "52d0b52d751cfc15cec85156d8628455", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10172, "upload_time": "2019-08-08T11:41:55", "url": "https://files.pythonhosted.org/packages/ed/84/fcc55772e8b9ecbb67baf1b395d512a0e6492bb2c34abeb6b3345dacd274/drive-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d78cb104ec19c16a17e81b5a42104af2", "sha256": "6da17943ebc25763b28e0fcd6fa20312bb057efd4153f4dd3bb5006cfee125c0" }, "downloads": -1, "filename": "drive-0.2.0.tar.gz", "has_sig": false, "md5_digest": "d78cb104ec19c16a17e81b5a42104af2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9382, "upload_time": "2019-08-08T11:41:57", "url": "https://files.pythonhosted.org/packages/57/3f/4e492bf1796a575c751ea8e9aae1a94fad2f390f53535c411eecc9ec9a6e/drive-0.2.0.tar.gz" } ] }