11from  typing  import  Any , Dict , Literal , Optional , Union 
22from  warnings  import  warn 
33
4- from  httpx  import  HTTPError , Response 
4+ from  httpx  import  AsyncClient ,  HTTPError , Response 
55
66from  ..errors  import  FunctionsHttpError , FunctionsRelayError 
77from  ..utils  import  (
8-     AsyncClient ,
98    FunctionRegion ,
109    is_http_url ,
1110    is_valid_jwt ,
@@ -19,9 +18,10 @@ def __init__(
1918        self ,
2019        url : str ,
2120        headers : Dict ,
22-         timeout : int ,
23-         verify : bool  =  True ,
21+         timeout : Optional [ int ]  =   None ,
22+         verify : Optional [ bool ]  =  None ,
2423        proxy : Optional [str ] =  None ,
24+         http_client : Optional [AsyncClient ] =  None ,
2525    ):
2626        if  not  is_http_url (url ):
2727            raise  ValueError ("url must be a valid HTTP URL string" )
@@ -30,15 +30,43 @@ def __init__(
3030            "User-Agent" : f"supabase-py/functions-py v{ __version__ }  ,
3131            ** headers ,
3232        }
33-         self ._client  =  AsyncClient (
34-             base_url = self .url ,
35-             headers = self .headers ,
36-             verify = bool (verify ),
37-             timeout = int (abs (timeout )),
38-             proxy = proxy ,
39-             follow_redirects = True ,
40-             http2 = True ,
41-         )
33+ 
34+         if  timeout  is  not None :
35+             warn (
36+                 "The 'timeout' parameter is deprecated. Please configure it in the http client instead." ,
37+                 DeprecationWarning ,
38+                 stacklevel = 2 ,
39+             )
40+         if  verify  is  not None :
41+             warn (
42+                 "The 'verify' parameter is deprecated. Please configure it in the http client instead." ,
43+                 DeprecationWarning ,
44+                 stacklevel = 2 ,
45+             )
46+         if  proxy  is  not None :
47+             warn (
48+                 "The 'proxy' parameter is deprecated. Please configure it in the http client instead." ,
49+                 DeprecationWarning ,
50+                 stacklevel = 2 ,
51+             )
52+ 
53+         self .verify  =  bool (verify ) if  verify  is  not None  else  True 
54+         self .timeout  =  int (abs (timeout )) if  timeout  is  not None  else  60 
55+ 
56+         if  http_client  is  not None :
57+             http_client .base_url  =  self .url 
58+             http_client .headers .update ({** self .headers })
59+             self ._client  =  http_client 
60+         else :
61+             self ._client  =  AsyncClient (
62+                 base_url = self .url ,
63+                 headers = self .headers ,
64+                 verify = self .verify ,
65+                 timeout = self .timeout ,
66+                 proxy = proxy ,
67+                 follow_redirects = True ,
68+                 http2 = True ,
69+             )
4270
4371    async  def  _request (
4472        self ,
0 commit comments