{ "info": { "author": "999hatsune", "author_email": "999hatsune@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: End Users/Desktop", "Intended Audience :: System Administrators", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 2 :: Only", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: System :: Archiving :: Mirroring", "Topic :: System :: Filesystems", "Topic :: System :: Networking", "Topic :: Utilities" ], "description": "googleDriveAccess\n=================\n\na Python tool to Access to the Google Drive ( OAuth2, Calendar, Gmail,\ngeocoding, spreadsheet, etc )\n\nPackage Documentation\nhttps://github.com/HatsuneMiku/googleDriveAccess/wiki/module\\_googleDriveAccess\n\nSample\n------\n\n::\n\n import os\n import googleDriveAccess as gda\n\n # create instance\n da = gda.DAClient(os.path.abspath('.'))\n\n # create parent folders at the same time\n folderId, folderPath = da.makeDirs('/remote_drive/subfolder_test/subsubfolder')\n print folderId, folderPath\n\n # recursive backup to remote folder\n da.recursiveUpload('a_local_directory_you_want_to_backup_recursively')\n\n # search\n da.execQuery(\"explicitlyTrashed=True\")\n da.execQuery(\"'root' in parents\", **{'maxResults': 5})\n da.execQuery(\"'root' in parents and explicitlyTrashed=True\", repeattoken=True, **{'maxResults': 500})\n\n # download (change fileId and correct mimeType 'application/octet-stream' etc.)\n da.downloadFile('/tmp', 'test_document.txt', parentId='root')\n\n # OAuth2\n oa2 = gda.OAuth2Client(abc=da)\n ui = oa2.userInfo()\n act = ui['email']\n print act\n\n # gmail\n gm = gda.GmailClient(abc=oa2)\n mo = gm.sendMsg(act, act, 'message title', 'message text')\n if mo:\n mo = gm.modifyLabels(mo['id'], addLabels=['INBOX', 'UNREAD', 'STARRED'])\n mo = gm.sendMsg(act, act, 'title attach', 'text attach', 'test_document.txt')\n if mo:\n mo = gm.modifyLabels(mo['id'], addLabels=['INBOX', 'UNREAD', 'STARRED'])\n msgs = gm.getMsgEntries(maxResults=3)\n for msg in msgs['messages']:\n mo = gm.getMsg(msg['id'])\n hdrs = gm.getHdrsDict(mo)\n for k in ('date', 'to', 'from', 'subject'):\n if k in hdrs: print u'%s: %s' % hdrs[k] # unicode\n # popup message from calendar may contain u'\\xbb'\n #print u'snippet: %s' % gm.trimWidth(mo['snippet'].replace(u'\\xbb', u'>'), 70)\n print u'snippet: %s' % gm.trimWidth(mo['snippet'], 70) # unicode\n\n # calendar\n import time\n ca = gda.CalendarClient('Asia/Tokyo', abc=oa2)\n cals = ca.idList()\n for cal in cals['items']:\n print u'%s : %s' % (cal['id'], cal['summary']) # unicode\n id = cals['items'][0]['id']\n print id\n TEST_TITLE = u'rendez-vous \u4eca\u65e5\u306e\u5f85\u3061\u5408\u308f\u305b' # unicode\n t = time.time()\n eo = ca.insertEvent(id,\n start=ca.isoDate(t), end=ca.isoDate(t + 24 * 3600), # date only\n location=u'\u7687\u5c45', summary=TEST_TITLE) # unicode\n eo = ca.insertEvent(id,\n start=ca.isoTime(t + 1800), end=ca.isoTime(t + 3600), # date and time\n location=u'\u4eac\u90fd\u5fa1\u6240', summary=TEST_TITLE) # unicode\n\n # geocoding\n geo = gda.GeocodingClient('ja', u'\u65e5\u672c')\n print geo.getLatLng(u'\u798f\u4e95\u770c\u6566\u8cc0\u5e02\u660e\u795e\u753a')\n print geo.getLocation(35.75, 136.02)\n geo.ignoreCountryHead = False\n print geo.getLocation(*geo.getLatLng(u'\u798f\u4e95\u770c\u6566\u8cc0\u5e02\u660e\u795e\u753a'))\n print geo.getLatLng(geo.getLocation(35.75, 136.02))\n\n # spreadsheet\n SHEET_NAME = 'test_spreadsheet_factory'\n ss = gda.SpreadsheetFactory(abc=oa2)(sheetName=SHEET_NAME)\n if ss.sheetId is None:\n ss.createSpreadsheet(SHEET_NAME, csv='c1,c2,c3\\n8,32,256\\n64,1024,65536\\n')\n print ss.oa2act\n print ss.sheet()['title']\n print ss.sheetId\n print ss.worksheetId\n for ws in ss.worksheets():\n print u'%s : %s' % (ws.get_worksheet_id(), ws.title.text)\n for cell in ss.cells():\n print u'%s : %s' % (cell.title.text, cell.content.text)\n\n # change True when you get a version (2013-07-12) after gdata-2.0.18\n # https://code.google.com/p/gdata-python-client/source/list\n if False:\n ss.updateCell(1, 1, u'\u65e5\u672c\u8a9e\u8868\u793a')\n ss.updateCell(3, 3, u'\u6f22\u5b57')\n\nHow to use it\n-------------\n\nInstall\n\n::\n\n pip install 'google-api-python-client'\n pip install googleDriveAccess\n (or easy_install googleDriveAccess)\n cd /opt/googleDriveAccess\n\nFirst, create your Client\\_ID and secret on the Google Drive.\n\nRegister your App on https://console.developers.google.com/project and\n*'download JSON'* of your Client ID and Client secret.\n\nRename this JSON file to './client\\_secret\\_[Client ID].json' .\n\n::\n\n mv client_secrets.json /opt/googleDriveAccess/client_secret_YOURCLIENTID.json\n\nSecond, create cache file for Client ID .\n\nCreate './cicache.txt' file and write your Client ID to the first line.\n\n::\n\n echo YOURCLIENTID > ./cicache.txt\n\nThird, encrypt secret file.\n\nExecute ./encrypt\\_client\\_secret.py to encrypt downloaded JSON file.\n\n::\n\n ./encrypt_client_secret.py\n\nCheck that encrypted file exists './client\\_secret\\ *[Client\nID].json.enc' and plain text JSON file './client\\_secret*\\ [Client\nID].json' will be deleted.\n\nExecute ./test\\_upload\\_first.py to test OAuth2 flow and store\ncredentials.\n\n::\n\n ./test_upload_first.py\n\nExecute ./test\\_upload\\_second.py to test OAuth2 using stored\ncredentials.\n\n::\n\n ./test_upload_second.py\n\nExecute ./test\\_download\\_third.py to test OAuth2 using stored\ncredentials.\n\n::\n\n ./test_download_third.py\n\nExecute ./test\\_folder\\_create.py to test OAuth2 and create folders.\nExecute ./test\\_folder\\_hierarchy.py to test OAuth2 and scan folders.\nExecute ./recursive\\_upload.py to test OAuth2 and upload files.\n\n::\n\n ./test_folder_create.py\n ./test_folder_hierarchy.py\n ./recursive_upload.py\n\nExecute ./test\\_calendar\\_v3.py to test OAuth2 and add calendar event.\nExecute ./test\\_gmail\\_v1.py to test OAuth2 and send mail and modify\nlabels. Execute ./test\\_geocoding.py to test geocoding. Execute\n./test\\_spreadsheet\\_factory.py to test OAuth2 and spreadsheet.\n\n::\n\n ./test_calendar_v3.py\n ./test_gmail_v1.py\n ./test_geocoding.py\n ./test_spreadsheet_factory.py\n\nExecute ./test\\_script\\_prefetch.py to test Drive API search with query.\n\n::\n\n ./test_script_prefetch.py\n\nEdit test\\_script\\_import\\_export.py (set 'mode = 0') to test create new\nGoogle Apps Script 'test\\_GoogleAppsScript\\_createCalendarEvent' for\ntests below.\n\nExecute ./test\\_script\\_import\\_export.py to test create and *'get\nSCRIPT\\_ID'* .\n\n::\n\n ./test_script_import_export.py\n\nEdit test\\_script\\_import\\_export.py (set 'mode = 2' and *'set\nSCRIPT\\_ID'*) to test download.\n\nExecute ./test\\_script\\_import\\_export.py to test download.\n\n::\n\n ./test_script_import_export.py\n\nEdit downloaded script\n'./script\\_import\\_export/test\\_GoogleAppsScript\\_createCalendarEvent/Code.gs'\n.\n\nEdit test\\_script\\_import\\_export.py (set 'mode = 1') to test upload.\n\nExecute ./test\\_script\\_import\\_export.py to test upload.\n\n::\n\n ./test_script_import_export.py\n\nKnown BUGs\n----------\n\nFails to create and update Google Apps Script.\n\n::\n\n mimeType was changed about specification of uploading Google Apps Script ?\n\nI will make refresh\\_cache.py :\n\n::\n\n This program will cache each folder (or file) ids assigned by the Google Drive.\n (Into the cache file cache_folderIds_[Client ID]_[OAuth2Act].sl3 .)\n Please search and erase a row that has same id from the cache file\n when you delete your folder or file using another Google Drive client tool.\n\nIt may be fixed:\n\n::\n\n When uploading a file that would not be automaticaly handled Google Drive,\n \"Media type 'None' is not supported. Valid media types: [*/*]\"\n error occurred.\n Because of default mimeType is set to None on uploadFile.\n So it may correct to catch the exception and retry with 'binary/octet-stream'.\n\nLinks\n-----\n\nPackage Documentation\nhttps://github.com/HatsuneMiku/googleDriveAccess/wiki/module\\_googleDriveAccess\n\nYou can get the latest version at this GitHub repository.\nhttps://github.com/HatsuneMiku/googleDriveAccess\n\nGitHub HomePage http://hatsunemiku.github.io/googleDriveAccess\n\nPyPI https://pypi.python.org/pypi/googleDriveAccess\n\nRelations\n---------\n\noauth2client-gdata-bridge\nhttps://github.com/hnakamur/gae-oauth2client-spreadsheet\n\npytz-memcache https://github.com/HatsuneMiku/pytz-memcache\n\npytz-memcache (PyPI) https://pypi.python.org/pypi/pytz-memcache\n\nLicense\n-------\n\nBSD License", "description_content_type": null, "docs_url": null, "download_url": "https://pypi.python.org/packages/source/g/googleDriveAccess/googleDriveAccess-0.1.6.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/HatsuneMiku/googleDriveAccess", "keywords": "GAE google app engine client api OAuth2 gmail mail calendar drive googledrive recursive upload backup import export apps script geocoding spreadsheet", "license": "BSD License", "maintainer": null, "maintainer_email": null, "name": "googleDriveAccess", "package_url": "https://pypi.org/project/googleDriveAccess/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/googleDriveAccess/", "project_urls": { "Download": "https://pypi.python.org/packages/source/g/googleDriveAccess/googleDriveAccess-0.1.6.tar.gz", "Homepage": "https://github.com/HatsuneMiku/googleDriveAccess" }, "release_url": "https://pypi.org/project/googleDriveAccess/0.1.6/", "requires_dist": null, "requires_python": null, "summary": "update spreadsheet with OAuth2 and recursive upload to Google Drive ( supports OAuth2, Calendar, Gmail, geocoding, spreadsheet, etc ) and import-export Google Apps Script source code", "version": "0.1.6" }, "last_serial": 1183117, "releases": { "0.0.10": [ { "comment_text": "", "digests": { "md5": "b8dadd3987f3627bf71ad7f9c04c5ca4", "sha256": "a4ef9efd67ca8c269229b8b0a89817ba8a99f0c328deb4cd4777f9814ed02a54" }, "downloads": -1, "filename": "googleDriveAccess-0.0.10.tar.gz", "has_sig": false, "md5_digest": "b8dadd3987f3627bf71ad7f9c04c5ca4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14242, "upload_time": "2014-07-14T07:14:18", "url": "https://files.pythonhosted.org/packages/d0/c0/afaf839512ac275fa6649135fbdc7e74564beb3d9c60559f01fd2af61959/googleDriveAccess-0.0.10.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "2563b3977af50b2fcb29c397c444c449", "sha256": "73fd54b2931c360688216d095e312d9278d3cd35afe00dbbdab1770b1c6cbbb7" }, "downloads": -1, "filename": "googleDriveAccess-0.1.1.tar.gz", "has_sig": false, "md5_digest": "2563b3977af50b2fcb29c397c444c449", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17006, "upload_time": "2014-07-27T08:34:07", "url": "https://files.pythonhosted.org/packages/89/92/b43bbf91297fe303bc5b380689a4b58ed48097d501c5cfd32dfa3b86a48b/googleDriveAccess-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "98a09c09bfe9246f8d49503eaf705de4", "sha256": "18426fe27bef21b7f1c4e3d149f5409011da348d6f83edc6a3c4f9bcf17feb0b" }, "downloads": -1, "filename": "googleDriveAccess-0.1.2.tar.gz", "has_sig": false, "md5_digest": "98a09c09bfe9246f8d49503eaf705de4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18177, "upload_time": "2014-07-31T01:07:11", "url": "https://files.pythonhosted.org/packages/34/d4/4b9b1f0f5d08e7fc4f79f5a866e8eef6a9b4cc1ad46dec46c73ba20c74f0/googleDriveAccess-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "05a2681b72658e22115e2e72fd9cf937", "sha256": "18c905e7c523f28059cc57432e1a6c3caf8fa6d006f696b6531bc33691ffb09a" }, "downloads": -1, "filename": "googleDriveAccess-0.1.3.tar.gz", "has_sig": false, "md5_digest": "05a2681b72658e22115e2e72fd9cf937", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20438, "upload_time": "2014-08-02T00:44:00", "url": "https://files.pythonhosted.org/packages/0d/ca/499736b52979ac46cd27c626ada9e414bc81ddb0ab1962a8e0d0367cce89/googleDriveAccess-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "c2f10590d7a532b013b4155fde876ab2", "sha256": "e39e5f4f88839f322272e843cb6bb684d251c2302d0b0fe9b672e31a5308ac4c" }, "downloads": -1, "filename": "googleDriveAccess-0.1.4.tar.gz", "has_sig": false, "md5_digest": "c2f10590d7a532b013b4155fde876ab2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22214, "upload_time": "2014-08-04T13:31:59", "url": "https://files.pythonhosted.org/packages/3a/93/063e9938d41229826eb6b34ae72aebda9f4795b79a379893fce2af96ce81/googleDriveAccess-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "6dd729ce93f69d2e8617a199a0d3300f", "sha256": "f93edd7718c6156423bee42659d17256619fe7d7289afdd166af8ad920f0472a" }, "downloads": -1, "filename": "googleDriveAccess-0.1.5.tar.gz", "has_sig": false, "md5_digest": "6dd729ce93f69d2e8617a199a0d3300f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22950, "upload_time": "2014-08-06T17:53:58", "url": "https://files.pythonhosted.org/packages/06/14/7a287f68d0f9c3241f1433c5866fc22c16a242501808975d5094bc244551/googleDriveAccess-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "fcc2d5a6e65f2b82f6ab779d4bf9362c", "sha256": "3ce2a5f53bba316b76fdaaf73ed19eeb77a1f9fd902913f7156f5a6339bffc40" }, "downloads": -1, "filename": "googleDriveAccess-0.1.6.tar.gz", "has_sig": false, "md5_digest": "fcc2d5a6e65f2b82f6ab779d4bf9362c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23415, "upload_time": "2014-08-07T17:04:22", "url": "https://files.pythonhosted.org/packages/4f/8e/f1d51eecabb4f9c7ad35b99be8d41aaf2dc11059147d9690a13e96e042fc/googleDriveAccess-0.1.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fcc2d5a6e65f2b82f6ab779d4bf9362c", "sha256": "3ce2a5f53bba316b76fdaaf73ed19eeb77a1f9fd902913f7156f5a6339bffc40" }, "downloads": -1, "filename": "googleDriveAccess-0.1.6.tar.gz", "has_sig": false, "md5_digest": "fcc2d5a6e65f2b82f6ab779d4bf9362c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23415, "upload_time": "2014-08-07T17:04:22", "url": "https://files.pythonhosted.org/packages/4f/8e/f1d51eecabb4f9c7ad35b99be8d41aaf2dc11059147d9690a13e96e042fc/googleDriveAccess-0.1.6.tar.gz" } ] }