从oauth2client.appengine导入oauth2decorator_from_clientsecrets importorror:没有名为appengin的模块

2024-05-14 21:49:16 发布

您现在位置:Python中文网/ 问答频道 /正文

运行应用程序时出现以下错误

from oauth2client.appengine import oauth2decorator_from_clientsecrets
ImportError: No module named appengine

这是我的main.py代码

import httplib2
import os
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from oauth2client.appengine import oauth2decorator_from_clientsecrets

CLIENT_SECRETS = os.path.join(os.path.dirname(__file__), 'client_secrets.json')

decorator = oauth2decorator_from_clientsecrets(CLIENT_SECRETS,
'https://www.googleapis.com/auth/bigquery')

class MainHandler(webapp.RequestHandler):
    @decorator.oauth_required
    def get(self):
       self.response.out.write("Hello Dashboard!\n")

application = webapp.WSGIApplication([
     ('/', MainHandler),
     ], debug=True)

def main():
    run_wsgi_app(application)

if __name__ == '__main__':
   main()

这是我的app.yaml

application: hellomydashboard
version: 1
runtime: python27
api_version: 1
threadsafe: false

handlers:
- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico

- url: /oauth2callback
  script: oauth2client/appengine.py

- url: .*
  script: main.app

Tags: frompyimportappurlapplicationosmain

热门问题