【问题标题】:tornado.httpclient.HTTPError: HTTP 599: Timeout during requesttornado.httpclient.HTTPError:HTTP 599:请求期间超时
【发布时间】:2018-11-30 22:25:22
【问题描述】:

我正在尝试使用 Python Tornado AsyncHTTPClient 发出一个长的异步 http 请求:

url = 'http://do_something_for_more_than_20_seconds.com/
client = httpclient.AsyncHTTPClient()
response = await client.fetch(url, method='GET')

但是,20 秒后,我收到此错误:

tornado.httpclient.HTTPError: HTTP 599: Timeout during request

如何配置client 以允许长请求?

我尝试在client初始化后添加这个配置行,但还是不行:

client.configure(None, defaults=dict(connect_timeout=60, request_timeout=120))

【问题讨论】:

    标签: python asynchronous tornado http-error


    【解决方案1】:

    如果您在客户端的构造函数中移动超时配置,它应该可以工作

    client = httpclient.AsyncHTTPClient(defaults=dict(request_timeout=180))
    

    【讨论】:

      猜你喜欢
      • 2019-11-21
      • 1970-01-01
      • 2011-02-26
      • 1970-01-01
      • 2015-10-03
      • 2011-04-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多