Although the Google App Engine and Google Drive are Google products, unfortunately they are not directly related. Google Drive APIs can be accessed through the google-api-python-client library that you must install.
This process can be found in the Python Drive API Quick Start Guide for Google Drive , and the summarized form is as follows:
On the Google side: Allow API access for the API for your GAE program
- Activate Drive API . Click Go to Credentials to continue ...
- Create a consent screen: Set your OAuth consent screen as Google will throw strange errors if this has not been configured:
- Click the OAuth Consent Screen tab
- Select Email Address and enter the Product Name .
- Get credentials:
- Go to the Credentials tab
- Select Add Credentials , and then OAuth 2.0 Client ID . Select your application type and enter the appropriate data. You can change them later!
- Go back to the Credentials tab, load the JSON credentials (everything is right in the table, the download button will appear only when you approach it). Rename it
client_secret.json and put it in the root directory. You will need this to request user credentials.
On your side: Download the google-api-python-client library , unzip it in your code directory and run python setup.py install . This will install a library containing many Google product APIs.
You are now ready to use the Drive API. You can check your access using the sample code . Read this because it is a good guide for writing your own code! If you are accessing user data, you will need to request the user credentials when they log in and most likely saved them. Then, to use the API, the easiest way would be to get a service object:
import httplib2 from apiclient import discovery credentials = get_credentials()
Above the code snippet, the sample code has been changed.
The reference API for Google Drive can be found here .
The same general procedure is required to associate GAE with other Google product APIs, for example, for example. The calendar. All the best that is written in your program!
source share