Python中文
首页
教程
问答
标签
搜索
登录
注册
如何在tornad中使用Asynchttp
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>AsynceHTTPClient不是非阻塞客户机?你知道吗</p> <p>当我使用请求获取响应时,它工作。但是当我使用asyncttttpclient发布请求时,它不起作用。你知道吗</p> <pre><code>async def go(): print('go---------------') client = AsyncHTTPClient() request = HTTPRequest(url='http://127.0.0.1:8001/api', method='GET',) r = await client.fetch(request) print(r.code, r.body) async def m(r): for _ in range(r): await go() loop = asyncio.get_event_loop() loop.run_until_complete(m(100)) </code></pre> <p>当我使用AsyncHTTPClient时,我认为结果如下</p> <p>走——走——走——走——走。。。。。。你知道吗</p> <p>但真正的结果是</p> <p>前进--200 b''前进--200 b''。。。。。。。你知道吗</p> <p>我想要一个非阻塞的请求,所以它可能会先发送所有100个请求,然后再接收响应,但是每次响应之后我都会得到每个响应。它不是非阻塞模式 我的代码有问题吗?我该怎么办?你知道吗</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>200是你的状态码。就像是</p> <p><code>go - r.status_code b'' go - r.status_code b'' .......</code></p> <p>当您从打印中删除您的状态码时,应该是正在打印</p> <p><code>go - go - go - go - ......</code></p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
无法使用Django/mongoengine连接到MongoDB(身份验证失败)
1 回答
无法使用Django\u mssql\u后端迁移到外部hos
2 回答
无法使用Django&Python3.4连接到MySql
8 回答
无法使用Django+nginx上载媒体文件
8 回答
无法使用Django1.6导入名称模式
10 回答
无法使用Django1.7和mongodb登录管理站点
5 回答
无法使用Djangoadmin创建项目,进程使用了错误的路径,因为我事先安装了错误的Python
3 回答
无法使用Djangockedi验证CBV中的字段
8 回答
无法使用Djangocketditor上载图像(错误400)
10 回答
无法使用Djangocron进行函数调用
9 回答
无法使用Djangofiler djang上载文件
6 回答
无法使用Djangokronos
3 回答
无法使用Djangomssql provid
2 回答
无法使用Djangomssql连接到带有Django 1.11的MS SQL Server 2016
5 回答
无法使用Djangomssq迁移Django数据库
2 回答
无法使用Djangonox创建用户
5 回答
无法使用Djangopyodb从Django查询SQL Server
5 回答
无法使用Djangopython3ldap连接到ldap
3 回答
无法使用Djangoredis连接到redis
3 回答
无法使用Django中的FK创建新表
9 回答