只是参考快速跑起来模版,细节或者封装流畅使用需要详细阅读aiohttp文档
1 import asyncio 2 3 async def foo(): 4 await print('bar') 5 6 loop = asyncio.get_event_loop() 7 future = asyncio.ensure_future(foo()) 8 loop.run_until_complete(future);
只是参考快速跑起来模版,细节或者封装流畅使用需要详细阅读aiohttp文档
1 import asyncio 2 3 async def foo(): 4 await print('bar') 5 6 loop = asyncio.get_event_loop() 7 future = asyncio.ensure_future(foo()) 8 loop.run_until_complete(future);