{ "info": { "author": "Iv\u00e1n de Paz Centeno", "author_email": "ipazc@unileon.es", "bugtrack_url": null, "classifiers": [ "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: Education", "Intended Audience :: Science/Research", "Natural Language :: English", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "===============\npygfolder 0.0.5\n===============\n\n`PyGFolder` is a package for managing the Google Drive content as a Python dictionary, with the same interface as `PyFolder `_.\n\n.. image:: https://badge.fury.io/py/pygfolder.svg\n :target: https://badge.fury.io/py/pygfolder\n\nAn easy example of usage is as follows:\n\n.. code:: python\n\n >>> from pygfolder import PyGFolder\n >>>\n >>> pygfolder = PyGFolder(\"/path/to/GoogleDrive/folder\")\n >>> pygfolder[\"file.txt\"] = b\"hello, this is going to be instantly the content of this file.\"\n >>> pygfolder[\"file.txt\"]\n b\"hello, this is going to be instantly the content of this file.\"\n\n\n`PyGFolder` allows to create/edit/remove elements from the google drive as if it was a Python Dict.\n\nInstallation\n============\n\nCurrently, it is only supported **Python 3.4.1** onwards:\n\n.. code:: bash\n\n sudo pip3 install pygfolder\n\nIt requires the credentials file generated at https://console.developers.google.com within your Google Drive account. Once you have generated the credentials for the Google Drive API (it is going to be a JSON file containing the OAUTH2 parameters such as *client_id*, *project_id*, *client_secret*, *auth_uri*, *...*), download the file and save it in your `$HOME` with the name \".pygfolder\".\n\n\nFirst run\n=========\n\nFor the first run, `PyGFolder` must request a token to the API. It can be accomplished by invoking the `request_token()` method:\n\n\n.. code:: python\n\n >>> from pygfolder import PyGFolder\n >>>\n >>> pygfolder = PyGFolder()\n >>> pygfolder.request_token()\n\nThis call will print a URL that you might need to visit in order to give access to `PyGFolder`. The step will finish when the code is retrieved back and manually filled into \".pygfolder\".\nAn example of the file should be as follows:\n\n.. code:: json\n \n {\n \"installed\": {\n \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\n \"redirect_uris\": [\n \"urn:ietf:wg:oauth:2.0:oob\",\n \"http://localhost\"\n ],\n \"project_id\": \"vast-ascent-XXXXXX\",\n \"client_id\": \"XXXXXX.apps.googleusercontent.com\",\n \"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\",\n \"token_uri\": \"https://accounts.google.com/o/oauth2/token\",\n \"code\": \"THE_CODE_RETURNED_BY_GOOGLE_MANUALLY_SET_HERE\",\n \"client_secret\": \"XXXXXX\"\n }\n }\n\nOnce the code is filled, `PyGFolder` will read it automatically (it has a trigger), and request an authorization token, which will be saved in the same file.\nNext executions of `PyGFolder` will not require this process, thus it should be only run once per machine.\n\nNote that \"~/.pygfolder\" contains all the required credentials data for `PyGFolder` to run. This means that transfering this file into another computer will allow `PyGFolder` to work out-of-the-box.\n\n\nUSAGE\n=====\n\n* **List elements in google drive:**\n\n.. code:: python\n\n >>> from pygfolder import PyGFolder\n >>>\n >>> pygfolder = PyGFolder(\"\")\n >>> print(pygfolder.keys()) # show files and folders\n >>> print(pygfolder.files()) # show only files\n >>> print(pygfolder.folders()) # show only folders\n\n* **Create a file with a specific content:**\n\n.. code:: python\n\n >>> pygfolder['pygfolder_file.txt'] = b\"Hello, this is the content of this root file from now on\"\n\n* **Access an element:**\n\n.. code:: python\n\n >>> file_content = pygfolder['pygfolder_file.txt'] # For accessing a file content\n >>> file_content = pygfolder['specific_folder'] # For accessing a folder content\n\nIn `PyGFolder`, each folder is represented by a `PyGFolder` object. For this reason, it is possible to access nested folders as follows:\n\n.. code:: python\n\n >>> folder = pygfolder['specific_folder1']['specific_folder2'] \n >>> folder = pygfolder['specific_folder1/specific_folder2'] # This is also equivalent\n\n\n* **Delete an element:**\n\n.. code:: python\n\n >>> del pygfolder['pygfolder_file.txt']) \n\n* **Iterate over files:**\n\n.. code:: python\n\n >>> for file, content in pygfolder.items()):\n >>> print(content)\n\n\n* **Export documents:**\n\nGoogle Apps stores the created documents within Google Drive, but they are not directly downloadable. If you want to download any of these, it must be exported to a specific `MimeType`.\n\n.. code:: python\n\n >>> result = pygfolder.export('My presentation', mimetype=\"application/pdf\") \n\n* **Create a folder:**\n\nFolders are automatically handled by `PyGFolder`. An example that is going to force `PyGFolder` to create a folder is as follows:\n\n.. code:: python\n\n >>> result = pygfolder[\"folder/content.txt\"] = b\"this will create automatically the folder 'folder' in order to create the file 'content.txt'\"\n\n\nLICENSE\n=======\n\nIt is released under the *MIT license*.\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/ipazc/pygfolder", "keywords": "pygfolder dict folder file filesystem google drive", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pygfolder", "package_url": "https://pypi.org/project/pygfolder/", "platform": "", "project_url": "https://pypi.org/project/pygfolder/", "project_urls": { "Homepage": "http://github.com/ipazc/pygfolder" }, "release_url": "https://pypi.org/project/pygfolder/0.0.5/", "requires_dist": null, "requires_python": "", "summary": "PyGFolder is a package for managing Google Drive folders as a dictionary.", "version": "0.0.5" }, "last_serial": 3309826, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "aa511be974ed41750975d9fd9a4d4348", "sha256": "52b2bcd81fe2caf60bd5c9f07fa379c736af76e3654ac9d27f2c2cd088ccbdd6" }, "downloads": -1, "filename": "pygfolder-0.0.1.tar.gz", "has_sig": false, "md5_digest": "aa511be974ed41750975d9fd9a4d4348", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5259, "upload_time": "2017-10-26T17:30:11", "url": "https://files.pythonhosted.org/packages/ce/6a/85eda87ba16e7decb44329129acc99c52fb7ea97d9672a463f03ef30af16/pygfolder-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "783164794b6b807018474fb778413a4b", "sha256": "b242ce9c12850028c5ceefbe93ae9cdbb8f9b037afb603dc065c2ba71f9f8543" }, "downloads": -1, "filename": "pygfolder-0.0.2.tar.gz", "has_sig": false, "md5_digest": "783164794b6b807018474fb778413a4b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5302, "upload_time": "2017-10-26T17:32:25", "url": "https://files.pythonhosted.org/packages/21/11/c50e1394bb3f6394cae760b0e9b6499ce88cd7eecb7e0d15cb51af61779e/pygfolder-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "0ddb72436b529fba2aa3e9f2f28a5fdb", "sha256": "0854afa979bd475eb423a38412d575efcfe11df4422921b871f9e640871b2358" }, "downloads": -1, "filename": "pygfolder-0.0.3.tar.gz", "has_sig": false, "md5_digest": "0ddb72436b529fba2aa3e9f2f28a5fdb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5314, "upload_time": "2017-10-26T17:35:27", "url": "https://files.pythonhosted.org/packages/44/b2/53339fe04c7f44f03bbb41b50fadfe45fd9b031b20b8cbcead8119d729db/pygfolder-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "9416c01a5a6bb2371f2d67bcdd6cf55c", "sha256": "f515cae01014985389b81e1c8aa7c6e651f704ca4c7875c36f646983dba24b98" }, "downloads": -1, "filename": "pygfolder-0.0.4.tar.gz", "has_sig": false, "md5_digest": "9416c01a5a6bb2371f2d67bcdd6cf55c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5323, "upload_time": "2017-10-26T17:37:12", "url": "https://files.pythonhosted.org/packages/dc/d9/b4735d9d16a5bb963f8b5dbe6e45ae3e5a477c42adc560e1491ab70cd7b9/pygfolder-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "deb6b74a7bc801004716132ef83d3323", "sha256": "362cc9ebdafa021a2a9a45f561fd0db088628da1452fa849d48558db6f322010" }, "downloads": -1, "filename": "pygfolder-0.0.5.tar.gz", "has_sig": false, "md5_digest": "deb6b74a7bc801004716132ef83d3323", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7174, "upload_time": "2017-11-06T15:46:45", "url": "https://files.pythonhosted.org/packages/62/5a/01dc7ec9c46829dd9c8cb9e5149238a33a9c54226ec941002222b4164ace/pygfolder-0.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "deb6b74a7bc801004716132ef83d3323", "sha256": "362cc9ebdafa021a2a9a45f561fd0db088628da1452fa849d48558db6f322010" }, "downloads": -1, "filename": "pygfolder-0.0.5.tar.gz", "has_sig": false, "md5_digest": "deb6b74a7bc801004716132ef83d3323", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7174, "upload_time": "2017-11-06T15:46:45", "url": "https://files.pythonhosted.org/packages/62/5a/01dc7ec9c46829dd9c8cb9e5149238a33a9c54226ec941002222b4164ace/pygfolder-0.0.5.tar.gz" } ] }