Skip to content

Commit 9a00193

Browse files
committed
fix: add deprecation warnings for params to remove in the future
1 parent d10f1a3 commit 9a00193

File tree

2 files changed

+52
-8
lines changed

2 files changed

+52
-8
lines changed

supabase_functions/_async/functions_client.py

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ def __init__(
1919
self,
2020
url: str,
2121
headers: Dict,
22-
timeout: int,
23-
verify: bool = True,
22+
timeout: Optional[int] = None,
23+
verify: Optional[bool] = None,
2424
proxy: Optional[str] = None,
2525
http_client: Optional[AsyncClient] = None,
2626
):
@@ -32,6 +32,28 @@ def __init__(
3232
**headers,
3333
}
3434

35+
if timeout is not None:
36+
warn(
37+
"The 'timeout' parameter is deprecated. Please configure it in the httpx client instead.",
38+
DeprecationWarning,
39+
stacklevel=2,
40+
)
41+
if verify is not None:
42+
warn(
43+
"The 'verify' parameter is deprecated. Please configure it in the httpx client instead.",
44+
DeprecationWarning,
45+
stacklevel=2,
46+
)
47+
if proxy is not None:
48+
warn(
49+
"The 'proxy' parameter is deprecated. Please configure it in the httpx client instead.",
50+
DeprecationWarning,
51+
stacklevel=2,
52+
)
53+
54+
self.verify = bool(verify) if verify is not None else True
55+
self.timeout = int(abs(timeout)) if timeout is not None else 60
56+
3557
if http_client is not None:
3658
http_client.base_url = self.url
3759
http_client.headers.update({**self.headers})
@@ -40,8 +62,8 @@ def __init__(
4062
self._client = AsyncClient(
4163
base_url=self.url,
4264
headers=self.headers,
43-
verify=bool(verify),
44-
timeout=int(abs(timeout)),
65+
verify=self.verify,
66+
timeout=self.timeout,
4567
proxy=proxy,
4668
follow_redirects=True,
4769
http2=True,

supabase_functions/_sync/functions_client.py

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ def __init__(
1919
self,
2020
url: str,
2121
headers: Dict,
22-
timeout: int,
23-
verify: bool = True,
22+
timeout: Optional[int] = None,
23+
verify: Optional[bool] = None,
2424
proxy: Optional[str] = None,
2525
http_client: Optional[SyncClient] = None,
2626
):
@@ -32,6 +32,28 @@ def __init__(
3232
**headers,
3333
}
3434

35+
if timeout is not None:
36+
warn(
37+
"The 'timeout' parameter is deprecated. Please configure it in the httpx client instead.",
38+
DeprecationWarning,
39+
stacklevel=2,
40+
)
41+
if verify is not None:
42+
warn(
43+
"The 'verify' parameter is deprecated. Please configure it in the httpx client instead.",
44+
DeprecationWarning,
45+
stacklevel=2,
46+
)
47+
if proxy is not None:
48+
warn(
49+
"The 'proxy' parameter is deprecated. Please configure it in the httpx client instead.",
50+
DeprecationWarning,
51+
stacklevel=2,
52+
)
53+
54+
self.verify = bool(verify) if verify is not None else True
55+
self.timeout = int(abs(timeout)) if timeout is not None else 60
56+
3557
if http_client is not None:
3658
http_client.base_url = self.url
3759
http_client.headers.update({**self.headers})
@@ -40,8 +62,8 @@ def __init__(
4062
self._client = SyncClient(
4163
base_url=self.url,
4264
headers=self.headers,
43-
verify=bool(verify),
44-
timeout=int(abs(timeout)),
65+
verify=self.verify,
66+
timeout=self.timeout,
4567
proxy=proxy,
4668
follow_redirects=True,
4769
http2=True,

0 commit comments

Comments
 (0)