Initial commit

This commit is contained in:
kdusek
2025-12-09 12:13:01 +01:00
commit 8e654ed209
13332 changed files with 2695056 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
import typing as tp
import httpx
from hishel._sync._transports import CacheTransport
__all__ = ("CacheClient",)
class CacheClient(httpx.Client):
def __init__(self, *args: tp.Any, **kwargs: tp.Any):
self._storage = kwargs.pop("storage") if "storage" in kwargs else None
self._controller = kwargs.pop("controller") if "controller" in kwargs else None
super().__init__(*args, **kwargs)
def _init_transport(self, *args, **kwargs) -> CacheTransport: # type: ignore
_transport = super()._init_transport(*args, **kwargs)
return CacheTransport(
transport=_transport,
storage=self._storage,
controller=self._controller,
)
def _init_proxy_transport(self, *args, **kwargs) -> CacheTransport: # type: ignore
_transport = super()._init_proxy_transport(*args, **kwargs) # pragma: no cover
return CacheTransport( # pragma: no cover
transport=_transport,
storage=self._storage,
controller=self._controller,
)