0
我想使用Google App Engine作爲我的天氣應用程序的代理。這裏是我嘗試轉換helloworld.py來做到這一點。我想使用Google App Engine連接到forecast.io
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腳本? 我能做些什麼來使這個簡單的腳本工作?