扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
1、aiohttp是一个基于asyncio模块的异步HTTP客户端/服务端框架。

宣恩网站制作公司哪家好,找创新互联公司!从网页设计、网站建设、微信开发、APP开发、响应式网站开发等网站项目制作,到程序开发,运营维护。创新互联公司于2013年开始到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联公司。
2、如无需保留请求的对话状态,请求将通过aiohttp.request直接发送回复。
3、aiohttp使用字典、list传递参数或直接通过传递字符串作为参数来传递。
实例
import time
import asyncio
import aiohttp
async def get_html():
async with aiohttp.request('GET', "https://open.163.com/") as res:
return await res.text()
async def main():
tasks = [asyncio.ensure_future(get_html()) for i in range(20)]
dones, pendings = await asyncio.wait(tasks)
for task in dones:
print(len(task.result()))
if __name__ == '__main__':
start_time = time.perf_counter()
asyncio.run(main())
print("aiohttp 异步采集消耗时间为:", time.perf_counter() - start_time)
# aiohttp 异步采集消耗时间为: 0.275251032以上就是python中aiohttp库的理解,希望对大家有所帮助。更多Python学习指路:创新互联python教程

我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流