A library for easy access to Google API from Google App Engine
This library alows easy acces to Google API from Google App Engine (GAE) application using OAuth 2.0 and service account. I is intended to be lightweight, understandable and resources friendly.
Only Calendar and Tasks APIs are currently implemented.
For examples of use see gapi/init.py
To start using this library create a GAE project (see Introduction) and acquire service_email service_key. To obtain one,
- go to API Console and click "API Access" in the left menu
- Click the "Create an OAuth 2.0 client ID..." button
- Fill the form (only "Product name" is required) and click "Next"
- Select "Service account" and click "Create client ID"
- Dowload the private key to a safe place
- Write somewhere the Service account EMAIL (will be used in gapi) and client ID (will be used to grant access to you calendar).
- Use convert_key.py utility to convert downloaded key to PEM format usable in Google App Engine
To be able to access a Google API which requires authentication, register your client ID in your Google APPs domain control panel. Depending on version of control panel, you can add new API client ID under "Advanced tools" / "Authentication" / "Manage third party OAuth Client access"
To find scopes, you need try:
from gapi import Api
api = Api(['calendar', 'tasks'], 'anything', 'anything')
print api.scope
Newer Google's APIs use JSON for communication and Signed JWT (JSON Web Token) for OAuth 2.0