1.aiohttp的简单使用(配合asyncio模块)

1.aiohttp的简单使用(配合asyncio模块)

def test111(req):
    time.sleep(5)
    return HttpResponse('test111 success')

def test222(req):
    time.sleep(6)
    return HttpResponse('test222 success')
def test333(req):
    time.sleep(7)
    return HttpResponse('test333 success')
def test444(req):
    time.sleep(8)
    return HttpResponse('test444 success')
	
node2:/root/python/20200525#time python3 t200.py 
http://192.168.137.3:9000/test111/
http://192.168.137.3:9000/test222/
http://192.168.137.3:9000/test333/
http://192.168.137.3:9000/test444/
test111 success
test222 success
test333 success
test444 success

real	0m8.378s
user	0m0.334s
sys	0m0.056s
原文地址:https://www.cnblogs.com/hzcya1995/p/13348361.html