Skip to content

Commit 9ad75b0

Browse files
fix: add "verify" flag to the creation of client
1 parent ed5ed18 commit 9ad75b0

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

storage3/_async/client.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,25 @@ class AsyncStorageClient(AsyncStorageBucketAPI):
1515
"""Manage storage buckets and files."""
1616

1717
def __init__(
18-
self, url: str, headers: dict[str, str], timeout: int = DEFAULT_TIMEOUT
18+
self,
19+
url: str,
20+
headers: dict[str, str],
21+
timeout: int = DEFAULT_TIMEOUT,
22+
verify: bool = True,
1923
) -> None:
2024
headers = {
2125
"User-Agent": f"supabase-py/storage3 v{__version__}",
2226
**headers,
2327
}
24-
self.session = self._create_session(url, headers, timeout)
28+
self.session = self._create_session(url, headers, timeout, verify)
2529
super().__init__(self.session)
2630

2731
def _create_session(
28-
self, base_url: str, headers: dict[str, str], timeout: int
32+
self, base_url: str, headers: dict[str, str], timeout: int, verify: bool = True
2933
) -> AsyncClient:
30-
return AsyncClient(base_url=base_url, headers=headers, timeout=timeout)
34+
return AsyncClient(
35+
base_url=base_url, headers=headers, timeout=timeout, verify=bool(verify)
36+
)
3137

3238
async def __aenter__(self) -> AsyncStorageClient:
3339
return self

storage3/_sync/client.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,25 @@ class SyncStorageClient(SyncStorageBucketAPI):
1515
"""Manage storage buckets and files."""
1616

1717
def __init__(
18-
self, url: str, headers: dict[str, str], timeout: int = DEFAULT_TIMEOUT
18+
self,
19+
url: str,
20+
headers: dict[str, str],
21+
timeout: int = DEFAULT_TIMEOUT,
22+
verify: bool = True,
1923
) -> None:
2024
headers = {
2125
"User-Agent": f"supabase-py/storage3 v{__version__}",
2226
**headers,
2327
}
24-
self.session = self._create_session(url, headers, timeout)
28+
self.session = self._create_session(url, headers, timeout, verify)
2529
super().__init__(self.session)
2630

2731
def _create_session(
28-
self, base_url: str, headers: dict[str, str], timeout: int
32+
self, base_url: str, headers: dict[str, str], timeout: int, verify: bool = True
2933
) -> SyncClient:
30-
return SyncClient(base_url=base_url, headers=headers, timeout=timeout)
34+
return SyncClient(
35+
base_url=base_url, headers=headers, timeout=timeout, verify=bool(verify)
36+
)
3137

3238
def __enter__(self) -> SyncStorageClient:
3339
return self

0 commit comments

Comments
 (0)