使用Google应用程序引擎python库验证Google地图引擎API
我想谷歌应用程序引擎python后端与谷歌地图引擎服务。以下是我的代码片段:使用Google应用程序引擎python库验证Google地图引擎API,python,google-app-engine,google-maps-engine,Python,Google App Engine,Google Maps Engine,我想谷歌应用程序引擎python后端与谷歌地图引擎服务。以下是我的代码片段: import os import urllib import webapp2 import jinja2 from apiclient import discovery import httplib2 from oauth2client.appengine import OAuth2Decorator decorator = OAuth2Decorator( client_id='<MY CLIEN
import os
import urllib
import webapp2
import jinja2
from apiclient import discovery
import httplib2
from 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 is 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)
看起来上面的脚本没有任何错误,但是没有返回任何信息。我已经在中通过oauth测试了请求,并且成功了
有人知道如何解决这个问题吗
谢谢