File size: 288 Bytes
bab4aa8
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import httpx

http_client: httpx.AsyncClient | None = None

async def init_http_client():
    global http_client
    http_client = httpx.AsyncClient()

async def close_http_client():
    global http_client
    if http_client:
        await http_client.aclose()
        http_client = None