Simply speaking, I have set up a "Google Apps Script Execution API" by following this guide: https://developers.google.com/apps-script/guides/rest/quickstart/python
I can call the Executable API from a local Python program with my client secret as described in the guide. No problem there.
But I actually want to call the API from Google App Engine with the same Google account. So, I thought "Service Account" might be the solution.
Therefore, I changed the way the credentials object is created to:
from oauth2client.appengine import AppAssertionCredentials
credentials = AppAssertionCredentials(
'https://www.googleapis.com/auth/sqlservice.admin')
Reference: developers.google.com /api-client-library/python/auth/service-accounts
But my Google App Engine web application is throwing this error:
INFO 2016-01-19 09:16:22,287 client.py:570] Attempting refresh to obtain initial access_token
WARNING 2016-01-19 09:16:22,297 urlfetch_stub.py:540] Stripped prohibited headers from URLFetch request: ['content-length']
{
"error": {
"code": 403,
"message": "Project has not enabled the API. Please use Google Developers Console to activate the 'script' API for your project.",
"errors": [
{
"message": "Project has not enabled the API. Please use Google Developers Console to activate the 'script' API for your project.",
"domain": "global",
"reason": "forbidden"
}
],
"status": "PERMISSION_DENIED"
}
}
I have already enabled the "Scripts Execution API" in both my scripts project and Google App Engine project. Can somebody please help? Thanks very much