Python 我想使用Google App Engine连接到forecast.io
我想使用谷歌应用程序引擎作为我的天气应用程序的代理。下面是我将helloworld.py转换为helloworld.py的尝试Python 我想使用Google App Engine连接到forecast.io,python,google-app-engine,Python,Google App Engine,我想使用谷歌应用程序引擎作为我的天气应用程序的代理。下面是我将helloworld.py转换为helloworld.py的尝试 import webapp2 import urllib2 class MainPage(webapp2.RequestHandler): def get(self): self.response.headers['Content-Type'] = 'text/plain' api_key = 'c6cxxx'
import webapp2
import urllib2
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
api_key = 'c6cxxx'
api_endpoint = 'https://api.forecast.io/forecast/'
url = api_endpoint + api_key + '/'
opener = urllib2.build_opener()
f = opener.open("[url]" + url + "[/url]")
self.response.write(f)
application = webapp2.WSGIApplication([('/', MainPage),], debug=True)
我只得到一台服务器500
有没有办法测试GAE脚本?
我该怎么做才能让这个简单的脚本工作?简短的回答是肯定的,有很多方法可以测试GAE应用程序 您在本地开发服务器上有问题吗?还是部署?您使用的是什么开发环境 您可能应该在dev服务器上调试代码,看看哪里出了问题。 如果您在生产环境中运行,那么导致错误的异常将显示在日志中,您可以通过管理页面查看日志