{ "info": { "author": "Anton Bukhtiyarov", "author_email": "apkraft@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Documentation", "Topic :: Utilities" ], "description": "# Docx to Google Drive uploader for Foliant\n\nGdoc is the Foliant CLI extension, it's used to upload created documents to Google Drive.\n\nGdoc adds `gupload` command to Foliant.\n\n\n## Installation\n\n```shell\n$ pip install foliantcontrib.gdoc\n```\n\n\n## Config\n\nTo config the CLI extension, add `gdrive_upload` section in the project config. As `gdoc` needs document to upload, appropriate backend settings also have to be here.\n\nCLI extension has a number of options (all fields are required but can have no values):\n\n```yaml\ngdrive_upload:\n gdrive_folder_name: Foliant upload\n gdrive_folder_id:\n gdoc_title:\n gdoc_id:\n com_line_auth: false\n```\n\n`gdrive_folder_name`\n: Folder with this name will be created on Google Drive to upload file.\n\n`gdrive_folder_id`\n: This field is necessary to upload files to previously created folder.\n\n`gdoc_title`\n: Uploaded file will have this title. If empty, real filename will be used.\n\n`gdoc_id`\n: This field is necessary to rewrite previously uploaded file and keep the link to it.\n\n`com_line_auth`\n: In some cases it's impossible to authenticate automatically (for example, with Docker), so you can set *True* and use command line authentication procedure.\n\n\n## Usage\n\nAt first you have to get Google Drive authentication file.\n\n1. Go to [APIs Console](https://console.developers.google.com/cloud-resource-manager) and make your own project.\n2. Go to [library](https://console.developers.google.com/apis/library), search for \u2018Google Drive API\u2019, select the entry, and click \u2018Enable\u2019.\n3. Select \u2018Credentials\u2019 from the left menu, click \u2018Create Credentials\u2019, select \u2018OAuth client ID\u2019.\n4. Now, the product name and consent screen need to be set -> click \u2018Configure consent screen\u2019 and follow the instructions. Once finished:\n - Select \u2018Application type\u2019 to be *Other types*.\n - Enter an appropriate name.\n - Input http://localhost:8080 for \u2018Authorized JavaScript origins\u2019.\n - Input http://localhost:8080/ for \u2018Authorized redirect URIs\u2019.\n - Click \u2018Save\u2019.\n5. Click \u2018Download JSON\u2019 on the right side of Client ID to download client_secret_.json. The downloaded file has all authentication information of your application.\n6. Rename the file to \u201cclient_secrets.json\u201d and place it in your working directory near foliant.yml.\n\nNow add the CLI extension to the project config with all settings strings. At this moment you have no data to set *Google Drive folder ID* and *google doc ID* so keep it empty.\n\nRun Foliant with `gupload` command:\n\n```shell\n$ foliant gupload docx\n\u2714 Parsing config\n\u2714 Applying preprocessor flatten\n\u2714 Making docx with Pandoc\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nResult: filename.docx\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\u2714 Parsing config\nYour browser has been opened to visit:\n\n https://accounts.google.com/o/oauth2/auth?...\n\nAuthentication successful.\n\u2714 Uploading 'filename.docx' to Google Drive\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nResult:\nDoc link: https://docs.google.com/document/d/1GPvNSMJ4ZutZJwhUYM1xxCKWMU5Sg/edit?usp=drivesdk\nGoogle drive folder ID: 1AaiWMNIYlq9639P30R3T9\nGoogle document ID: 1GPvNSMJ4Z19YM1xCKWMU5Sg\n```\n\nAuthentication form will be opened. Choose account to log in.\n\nWith command line authentication procedure differs little bit:\n\n```\n$ docker-compose run --rm foliant gupload docx\n\u2714 Parsing config\n\u2714 Applying preprocessor flatten\n\u2714 Making docx with Pandoc\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nResult: filename.docx\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\u2714 Parsing config\nGo to the following link in your browser:\n\n https://accounts.google.com/o/oauth2/auth?...\n\nEnter verification code: 4/XgBllTXpxv8kKjsiTxLc\nAuthentication successful.\n\u2714 Uploading 'filename.docx' to Google Drive\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nResult:\nDoc link: https://docs.google.com/document/d/1GPvNSMJ4ZutZJwhUYM1xxCKWMU5Sg/edit?usp=drivesdk\nGoogle drive folder ID: 1AaiWMNIYlq9639P30R3T9\nGoogle document ID: 1GPvNSMJ4Z19YM1xCKWMU5Sg\n```\n\nCopy link from terminal to your browser, choose account to log in and copy generated code back to the terminal.\n\nAfter that the document will be uploaded to Google Drive and opened in new browser tab.\n\nNow you can use *Google Drive folder ID* to upload files to the same folder and *google doc ID* to rewrite document (also you can IDs in folder and file links).\n\n### Notes\n\nIf you set up *google doc ID* without *Google Drive folder ID* file will be moved to the new folder with the same link.\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/foliant-docs/foliantcontrib.gdoc", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "foliantcontrib.gdoc", "package_url": "https://pypi.org/project/foliantcontrib.gdoc/", "platform": "any", "project_url": "https://pypi.org/project/foliantcontrib.gdoc/", "project_urls": { "Homepage": "https://github.com/foliant-docs/foliantcontrib.gdoc" }, "release_url": "https://pypi.org/project/foliantcontrib.gdoc/1.1.0/", "requires_dist": null, "requires_python": "", "summary": "Documents to Google Drive uploader.", "version": "1.1.0" }, "last_serial": 4307419, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "13f679d31afc5b61b1371cc402d8a421", "sha256": "c3e6371abb66cee04a54e0cd6ef0a910469045954015f9617a08f273a5b87d0a" }, "downloads": -1, "filename": "foliantcontrib.gdoc-1.0.0.tar.gz", "has_sig": false, "md5_digest": "13f679d31afc5b61b1371cc402d8a421", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4053, "upload_time": "2018-09-17T10:47:22", "url": "https://files.pythonhosted.org/packages/b3/b3/66c5119cfd0870750a164ea4590111031602b07624e38ad4bd9dcd0c2f82/foliantcontrib.gdoc-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "499e4731bbb5f50d405c59573819ddfb", "sha256": "f36f972022bdd81836d16b5245f7b003b7f798d7fde9d6f79638f121ecad6bd5" }, "downloads": -1, "filename": "foliantcontrib.gdoc-1.0.1.tar.gz", "has_sig": false, "md5_digest": "499e4731bbb5f50d405c59573819ddfb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4328, "upload_time": "2018-09-18T06:06:54", "url": "https://files.pythonhosted.org/packages/cb/da/f05b2de82efcf3a30b264abeb3cb57208bcbc333a408ca832fa2d53b1dba/foliantcontrib.gdoc-1.0.1.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "c24f47fee4fe1527b9fc8a9365b55499", "sha256": "fcc881313deaeaebb5ed640a84b79354a6bb366d863fd0a5328f3f66d7154c81" }, "downloads": -1, "filename": "foliantcontrib.gdoc-1.1.0.tar.gz", "has_sig": false, "md5_digest": "c24f47fee4fe1527b9fc8a9365b55499", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4529, "upload_time": "2018-09-25T06:48:27", "url": "https://files.pythonhosted.org/packages/8f/38/fba4e4e5b3903786528dd87b706c87457b021b6009693ad0f349e5e27158/foliantcontrib.gdoc-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c24f47fee4fe1527b9fc8a9365b55499", "sha256": "fcc881313deaeaebb5ed640a84b79354a6bb366d863fd0a5328f3f66d7154c81" }, "downloads": -1, "filename": "foliantcontrib.gdoc-1.1.0.tar.gz", "has_sig": false, "md5_digest": "c24f47fee4fe1527b9fc8a9365b55499", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4529, "upload_time": "2018-09-25T06:48:27", "url": "https://files.pythonhosted.org/packages/8f/38/fba4e4e5b3903786528dd87b706c87457b021b6009693ad0f349e5e27158/foliantcontrib.gdoc-1.1.0.tar.gz" } ] }