请求特定网址时 App Engine 中的 DownloadError

DownloadError in App Engine when requesting specific urls

我在尝试使用 urlfetch.fetch

请求特定 url 时遇到奇怪的 DownloadError

示例代码如下:

url = 'https://iiko.net:9900/api/0/auth/access_token'
try:
    result = urlfetch.fetch(url, deadline=50, validate_certificate=False)
    if result.status_code == 200:
        pass
 except DownloadError as er:
    logging.exception(er)

这里是错误:

Unable to fetch URL: https://iiko.net:9900/api/0/auth/access_token
Traceback (most recent call last):
  File "/base/data/home/apps/s~iappintheair/phil-dev.383038517236330514/handlers/api/test.py", line 18, in get
    result = urlfetch.fetch(url, deadline=50, validate_certificate=False)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/urlfetch.py", line 271, in fetch
    return rpc.get_result()
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 613, in get_result
    return self.__get_result_hook(self)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/urlfetch.py", line 414, in _get_fetch_result
    raise DownloadError("Unable to fetch URL: " + url + error_detail)
DownloadError: Unable to fetch URL: https://iiko.net:9900/api/0/auth/access_token

我确定它与截止日期无关,因为此代码会在几秒钟内失败。

可能与该网站上损坏的 ssl 证书有关,或者 GAE ip 地址因某种原因被该网站阻止,但我现在无法联系他们。

感谢任何帮助,谢谢!

这个问题的原因是 SSL 证书损坏,现在一切正常。 作为一种解决方法,我们使用了代理服务器,我知道这不是一个完美的解决方案,但我不知道如何在应用引擎级别修复它。