Showing posts with label Google Drive API. Show all posts
Showing posts with label Google Drive API. Show all posts

2016/11/04

Google Drive API - Listing all files on a client's Google Drive using JavaScipt

The code below runs on a web sever and it lists all files on Google Drive. Be sure to put in your client id (highlighted in yellow below) before running it.

2016/10/31

Google Drive API - How to find file id by filename and download non Google Doc files to local storage using Python

This tutorial is based on Google Drive API v3 and Python 2.7.9.

The code below allows its user to specify the name of the file to be searched for on his/her own Google Drive. Once the file is found, the user will then be prompted on whether to download the file to the local storage or not. The download is limited to non Google Doc files. For Google Doc files, please refer to the sample code at http://wei48221.blogspot.tw/2016/10/google-drive-api-uploading-downloading.html.

2016/10/26

PyDrive Quick Overview - Authentication and File Listing - PyDrive vs Drive API Python

I came across PyDrive (https://pythonhosted.org/PyDrive/index.html) while trying to learn how to use Python to access Google Drive via Google Drive API. For someone struggling to understand how to use the Google Drive API, I think it's a godsend to have PyDrive..

OAuth2 authentication

Using PyDrive

1
2
3
4
from pydrive.auth import GoogleAuth

gauth = GoogleAuth()
gauth.LocalWebserverAuth() # Creates local webserver and auto handles authentication.

2016/10/25

2016/10/24

Google Drive API: Uploading Files And Downloading (Exporting) Google Doc Files Using Python

This is a quick note about the Google Drive API: Uploading & Downloading Files sample at https://youtu.be/-7YH6rdR-tk.

The original Python script can be downloaded from http://wescpy.blogspot.tw/2015/12/google-drive-uploading-downloading.html.

When using the v2 version API, the 'hello.txt' can be uploaded and converted into Google Doc format and stored on my Google Drive. However, the conversion to PDF and download the file to my local disk part isn't working.

Python Script - v2 version API

Notes on the common code section for accessing Google APIs using Python

This post contains my notes after watching the 2 videos below.

Google Drive API: Uploading & Downloading Files
https://youtu.be/-7YH6rdR-tk

Accessing Google APIs: Common code walkthrough
https://youtu.be/h-gBeC9Y9cE?list=PLOU2XLYxmsILOIxBRPPhgYbuSslr50KVq

The Common Code Section

Below are the first 21 lines of code for uploading and downloading files using Google Drive API. They are the common code (with minor changes to the parameters in Line 14 - SCOPE and Line 21 - DRIVE) needed for accessing Google APIs.

Notes about Google Drive API Python Quickstart example

Here are some notes about the Python Quickstart example given by Google which I think will be useful for newbie like me.

https://developers.google.com/drive/v3/web/quickstart/python.