Template
mirror of
https://github.com/ijaric/voice_assistant.git
synced 2026-09-13 02:00:20 +03:00
feat: example of httpx async client
This commit is contained in:
@@ -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
|
||||||
Reference in New Issue
Block a user