Google App Engineから入手できるurlfetchを使用して、URLコンテンツをフェッチしています。しかし、500内部サーバーエラーが発生します。
これが私が使用している完全なアプリコードです:-
比較-hatke.py
import urllib2
from google.appengine.api import urlfetch
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
import datetime
class MainPage(webapp.RequestHandler):
def curlTry:
url = "http://www.google.com/"
result = urlfetch.fetch(url)
if result.status_code == 200:
print(result.content)
application = webapp.WSGIApplication([('/', MainPage)],debug=True)
def main():
run_wsgi_app(application)
if __name__ == '__main__':
main()
app.yaml
application: compare-hatke
version: 3
runtime: python27
api_version: 1
threadsafe: false
handlers:
- url: /.*
script: compare-hatke.app
これがエラーログです。彼らが言及している構文エラーを理解できません
Traceback (most recent call last):
File "/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 196, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 269, in _LoadHandler
raise ImportError('%s has no attribute %s' % (handler, name))
ImportError: <module 'compare-hatke' from '/base/data/home/apps/s~compare-hatke/3.365290288779373200/compare-hatke.pyc'> has no attribute app
私が行方不明になっている場所を教えてください。ありがとう !