1
0
mirror of https://github.com/ijaric/voice_assistant.git synced 2025-05-24 14:33:26 +00:00

feat: example of httpx async client

This commit is contained in:
Artem Litvinov 2023-09-30 21:34:42 +01:00
parent 47f898ae18
commit 8f2065e31f

View File

@ -0,0 +1,12 @@
# Purpose: Provide an example of an async http client for the application
import contextlib
import typing
import httpx
@contextlib.asynccontextmanager
async def get_http_client() -> typing.AsyncGenerator[httpx.AsyncClient, None]:
client = httpx.AsyncClient() # Insert your own settings here
async with client as ac:
yield ac