Getting broken link error whle Using App Engine service accounts
- by jade
I'm following this tutorial
https://developers.google.com/bigquery/docs/authorization#service-accounts-appengine
Here is my main.py code
import httplib2
from apiclient.discovery import build
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from oauth2client.appengine import AppAssertionCredentials
# BigQuery API Settings
SCOPE = 'https://www.googleapis.com/auth/bigquery'
PROJECT_NUMBER = 'XXXXXXXXXX' # REPLACE WITH YOUR Project ID
# Create a new API service for interacting with BigQuery
credentials = AppAssertionCredentials(scope=SCOPE)
http = credentials.authorize(httplib2.Http())
bigquery_service = build('bigquery', 'v2', http=http)
class ListDatasets(webapp.RequestHandler):
def get(self):
datasets = bigquery_service.datasets()
listReply = datasets.list(projectId=PROJECT_NUMBER).execute()
self.response.out.write('Dataset list:')
self.response.out.write(listReply)
application = webapp.WSGIApplication(
[('/listdatasets(.*)', ListDatasets)],
debug=True)
def main():
run_wsgi_app(application)
if __name__ == "__main__":
main()
Here is my app.yaml file code
application: bigquerymashup
version: 1
runtime: python
api_version: 1
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: .*
script: main.py
And yes i have added app engine service account name in google api console Team tab with can edit permissions.
When upload the app and try to access the link it says
Oops! This link appears to be broken.
Ealier i ran this locally and tried to access it using link localhost:8080.Then i thought may be running locally might be giving the error so i uploaded my code to
http://bigquerymashup.appspot.com/
but still its giving error.