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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章