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

问题描述 投票:3回答:1

我在尝试使用urlfetch.fetch请求特定网址时遇到奇怪的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地址因某些原因被本网站阻止,但我现在无法与他们联系。

任何帮助表示感谢,谢谢!

google-app-engine urlfetch google-app-engine-python
1个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.