Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 从oauth2client.appengine导入oauth2decorator\u from\u clientsecrets ImportError:没有名为appengine的模块_Python_Google App Engine_Oauth_Google Bigquery_Google Api Python Client - Fatal编程技术网

Python 从oauth2client.appengine导入oauth2decorator\u from\u clientsecrets ImportError:没有名为appengine的模块

Python 从oauth2client.appengine导入oauth2decorator\u from\u clientsecrets ImportError:没有名为appengine的模块,python,google-app-engine,oauth,google-bigquery,google-api-python-client,Python,Google App Engine,Oauth,Google Bigquery,Google Api Python Client,我在尝试运行应用程序时遇到以下错误 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 impo

我在尝试运行应用程序时遇到以下错误

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()
这是我的应用程序

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

这里的第一个问题是您已将/oauth2callback处理程序添加到app.yaml。请参阅此处有关装饰器的文档:

或此处的示例代码:

至于导入错误,您是否已将库的代码安装到App Engine项目中?最简单的方法是下载最新的google-api-python-client-gae-NN.zip并将其直接解压缩到您的项目中