python - tornado.httpclient.HTTPError:HTTP 599:请求期间超时
问题描述
我正在尝试使用 Python Tornado 发出一个长的异步 http 请求AsyncHTTPClient
:
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))
解决方案
如果您在客户端的构造函数中移动超时配置,它应该可以工作
client = httpclient.AsyncHTTPClient(defaults=dict(request_timeout=180))
推荐阅读
- java - 创建在变量中定义的类的 ArrayList
- amazon-elastic-beanstalk - Terraform - Elastic Beanstalk - 如何交换环境 URL
- chisel - 如何在最终的 Verilog 文件中为模块序列中的每个元素赋予唯一的名称
- audio - Swift:命令中心不起作用,即使我明确设置按钮启用?
- c - OpenMP 并行化比顺序慢
- typescript - 打字稿:推断传递函数参数的类型
- javascript - 如何在 CSS 中向下移动剪贴蒙版?
- android - 将实时数据库 DatabaseReference.addListenerForSingleValueEvent 转换为云 Firestore
- firebase - Firebase 规则以设置特定属性的读/写
- mongodb - 在基于 Mongo 的 API 中搜索多个 ObjectId 的 HTTP 请求?