2

Python アプリ エンジンの開発サーバーで 504 エラーに悩まされています。私は企業のプロキシの背後にいますが、通常は HTTP_PROXY と HTTPS_PROXY を設定しても問題はありません。それが私の問題に関連しているかどうかはわかりません。

私のコードでは、apiclient からの検出を使用しています (main.py 行 63)

driveService = discovery.build("drive", "v2", http=http)

これを実行すると、次のトレースバックが表示されます

INFO     2013-10-07 13:49:42,812 discovery.py:190] URL being requested: https://www.googleapis.com/discovery/v1/apis/drive/v2/rest?userIp=%3A%3A1
ERROR    2013-10-07 13:49:55,848 wsgi.py:262]
Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 239, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 298, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 84, in LoadObject
    obj = __import__(path[0])
  File "c:\temp\iterlex-backend\main.py", line 63, in <module>
    driveService = discovery.build("drive", "v2", http=http)
  File "c:\temp\iterlex-backend\oauth2client\util.py", line 132, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "c:\temp\iterlex-backend\apiclient\discovery.py", line 192, in build
    resp, content = http.request(requested_url)
  File "c:\temp\iterlex-backend\httplib2\__init__.py", line 1464, in request
    cached_value = self.cache.get(cachekey)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\memcache\__init__.py", line 559, in get
    results = rpc.get_result()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 612, in  get_result
    return self.__get_result_hook(self)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\memcache\__init__.py", line 615, in __get_hook
    rpc.check_success()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 578, in check_success
    self.__rpc.CheckSuccess()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apiproxy_rpc.py", line 156, in _WaitImpl
    self.request, self.response)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\remote_api\remote_api_stub.py", line 200, in MakeSyncCall
    self._MakeRealSyncCall(service, call, request, response)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\remote_api\remote_api_stub.py", line 226, in _MakeRealSyncCall
    encoded_response = self._server.Send(self._path, encoded_request)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appengine_rpc.py", line 393, in Send
    f = self.opener.open(req)
  File "C:\tools\Python27\lib\urllib2.py", line 397, in open
    response = meth(req, response)
  File "C:\tools\Python27\lib\urllib2.py", line 510, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\tools\Python27\lib\urllib2.py", line 435, in error
    return self._call_chain(*args)
  File "C:\tools\Python27\lib\urllib2.py", line 369, in _call_chain
    result = func(*args)
  File "C:\tools\Python27\lib\urllib2.py", line 518, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 504: Gateway Time-out
HTTPError()

同じコンソールウィンドウでcurlを使用して問題のあるURLを試すと、機能します(ただし、-kオプションを使用する必要があります)

C:\temp> curl -k https://www.googleapis.com/discovery/v1/apis/drive/v2/rest?userIp=%3A%3A1
{
 "kind": "discovery#restDescription",
 "etag": "\"XflbyoTZtBo225MnsgwJQ-FHlhA/AFnpisGyT0XxOrZz7gMWdR5PpRg\"",
...

App Engine と Python は初めてなので、少し迷っていることを告白します。どんな助けでも大歓迎です

ありがとう!ニコラス

4

0 に答える 0