File size: 411 Bytes
bb7c9a3
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from dependency_injector.resources import AsyncResource
from httpx import AsyncClient
from typing import Self


# TODO: Implement HTTPClientService to abstract away underlying HTTP client.


class HTTPClientServiceResource(AsyncResource):
    async def init(self: Self) -> AsyncClient:
        return AsyncClient()

    async def shutdown(self: Self, client: AsyncClient) -> None:
        await client.aclose()