Slide 179
Slide 179 text
考え中のお客様がgoogle検索
async def long_think(client, num: int):
print("ͪΐͬͱͬͯͶ")
response = await client.get("https://www.google.com/search?q=͓͍͍͓͠ڶഴʁ")
return num, response, "͟Δͦ"
async def order():
print("“͝จʁ”")
async with httpx.AsyncClient() as client:
tasks = [long_think(client, 1), long_think(client, 2), long_think(client, 3)]
result = await asyncio.gather(*tasks)
print(result)
start = time()
asyncio.run(order(), debug=True)
print("time: ", time() - start)
l͝จʁz
ͪΐͬͱͬͯͶ
ͪΐͬͱͬͯͶ
ͪΐͬͱͬͯͶ
<
3FTQPOTF<0,>
b͟Δͦ`
UJNF