@@ -88,6 +88,8 @@ def __init__(
8888 ssl_verify : Union [bool , "ssl.SSLContext" ] = ...,
8989 trust_env : bool = True ,
9090 proxy : Optional [ProxyTypes ] = None ,
91+ transport : Optional [httpx .BaseTransport ] = None ,
92+ async_transport : Optional [httpx .AsyncBaseTransport ] = None ,
9193 cache_strategy : Optional [BaseCacheStrategy ] = None ,
9294 http_cache : bool = True ,
9395 throttler : Optional [BaseThrottler ] = None ,
@@ -110,6 +112,8 @@ def __init__(
110112 ssl_verify : Union [bool , "ssl.SSLContext" ] = ...,
111113 trust_env : bool = True ,
112114 proxy : Optional [ProxyTypes ] = None ,
115+ transport : Optional [httpx .BaseTransport ] = None ,
116+ async_transport : Optional [httpx .AsyncBaseTransport ] = None ,
113117 cache_strategy : Optional [BaseCacheStrategy ] = None ,
114118 http_cache : bool = True ,
115119 throttler : Optional [BaseThrottler ] = None ,
@@ -132,6 +136,8 @@ def __init__(
132136 ssl_verify : Union [bool , "ssl.SSLContext" ] = ...,
133137 trust_env : bool = True ,
134138 proxy : Optional [ProxyTypes ] = None ,
139+ transport : Optional [httpx .BaseTransport ] = None ,
140+ async_transport : Optional [httpx .AsyncBaseTransport ] = None ,
135141 cache_strategy : Optional [BaseCacheStrategy ] = None ,
136142 http_cache : bool = True ,
137143 throttler : Optional [BaseThrottler ] = None ,
@@ -153,6 +159,8 @@ def __init__(
153159 ssl_verify : Union [bool , "ssl.SSLContext" ] = True ,
154160 trust_env : bool = True ,
155161 proxy : Optional [ProxyTypes ] = None ,
162+ transport : Optional [httpx .BaseTransport ] = None ,
163+ async_transport : Optional [httpx .AsyncBaseTransport ] = None ,
156164 cache_strategy : Optional [BaseCacheStrategy ] = None ,
157165 http_cache : bool = True ,
158166 throttler : Optional [BaseThrottler ] = None ,
@@ -174,6 +182,8 @@ def __init__(
174182 ssl_verify = ssl_verify ,
175183 trust_env = trust_env ,
176184 proxy = proxy ,
185+ transport = transport ,
186+ async_transport = async_transport ,
177187 cache_strategy = cache_strategy ,
178188 http_cache = http_cache ,
179189 throttler = throttler ,
@@ -241,11 +251,14 @@ def _create_sync_client(self) -> httpx.Client:
241251 if self .config .http_cache :
242252 return hishel .CacheClient (
243253 ** self ._get_client_defaults (),
254+ transport = self .config .transport ,
244255 storage = self .config .cache_strategy .get_hishel_storage (),
245256 controller = self .config .cache_strategy .get_hishel_controller (),
246257 )
247258
248- return httpx .Client (** self ._get_client_defaults ())
259+ return httpx .Client (
260+ ** self ._get_client_defaults (), transport = self .config .transport
261+ )
249262
250263 # get or create sync client
251264 @contextmanager
@@ -263,11 +276,14 @@ def _create_async_client(self) -> httpx.AsyncClient:
263276 if self .config .http_cache :
264277 return hishel .AsyncCacheClient (
265278 ** self ._get_client_defaults (),
279+ transport = self .config .async_transport ,
266280 storage = self .config .cache_strategy .get_async_hishel_storage (),
267281 controller = self .config .cache_strategy .get_hishel_controller (),
268282 )
269283
270- return httpx .AsyncClient (** self ._get_client_defaults ())
284+ return httpx .AsyncClient (
285+ ** self ._get_client_defaults (), transport = self .config .async_transport
286+ )
271287
272288 # get or create async client
273289 @asynccontextmanager
0 commit comments