Authenticate Google Maps Engine API using Google App Engine python library -
Authenticate Google Maps Engine API using Google App Engine python library -
i google app engine python back-end working google maps engine service. here code snippets:
import os import urllib import webapp2 import jinja2 apiclient import discovery import httplib2 oauth2client.appengine import oauth2decorator decorator = oauth2decorator( client_id='<my client id>', client_secret='<my client secret>', scope='https://www.googleapis.com/auth/mapsengine.readonly') service = discovery.build('mapsengine', 'v1') jinja_environment = jinja2.environment( loader=jinja2.filesystemloader(os.path.dirname(__file__)), extensions=['jinja2.ext.autoescape'], autoescape=true) class printhandler(webapp2.requesthandler): def render_response(self, **kwargs): template = jinja_environment.get_template('report.html') self.response.write(template.render(**kwargs)) @decorator.oauth_aware def post(self): if decorator.has_credentials(): request = service.tables().features().list(id='<table id>') if request not none: response = request.execute(decorator.http()) self.render_response(features=response['features']) else: url = decorator.authorize_url() self.render_response(authorize_url=url) app = webapp2.wsgiapplication([ ('/', printhandler), (decorator.callback_path, decorator.callback_handler()) ], debug=true)
it looks above script not have error, no info returned. have tested request through oauth in https://developers.google.com/apis-explorer/#p/mapsengine/v1/, , succeeded.
does know how prepare issue?
thanks!
python google-app-engine google-maps-engine
Comments
Post a Comment