Inside a Django async view, you want to fetch JSON data from an external API using the httpx library asynchronously. Which snippet correctly performs this operation?
hard📝 component behavior Q8 of 15
Django - Async Django
Inside a Django async view, you want to fetch JSON data from an external API using the httpx library asynchronously. Which snippet correctly performs this operation?
Aresponse = httpx.get('https://api.example.com/data')
data = response.json()
Bclient = httpx.Client()
response = client.get('https://api.example.com/data')
data = response.json()
Casync with httpx.AsyncClient() as client:
response = await client.get('https://api.example.com/data')
data = response.json()