3

尝试使用 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-addresses 因某种原因被此网站阻止,但我现在无法联系他们。

任何帮助表示赞赏,谢谢!

4

1 回答 1

0

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

于 2015-03-27T11:54:19.517 回答