httpxで非同期リクエストを送る
https://www.python-httpx.org/async/#making-async-requests
code:async_example.py
>> import httpx
>> async def request():
... async with httpx.AsyncClient() as client:
... return await client.get('https://www.example.com/')
>> import asyncio
>> asyncio.run(request())
<Response 200 OK>
>> r = asyncio.run(request())
Python 3.9で検証した
async/awaitはasync defの外では使えないっぽい
SyntaxError: 'async with' outside async function
SyntaxError: 'await' outside function
10.3 asyncioモジュールで理解深まった