Skip to content

Commit ffe9e28

Browse files
fix: add "verify" flag to the creation of client
1 parent 3161d15 commit ffe9e28

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

postgrest/_async/client.py

+4
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@ def __init__(
2828
schema: str = "public",
2929
headers: Dict[str, str] = DEFAULT_POSTGREST_CLIENT_HEADERS,
3030
timeout: Union[int, float, Timeout] = DEFAULT_POSTGREST_CLIENT_TIMEOUT,
31+
verify: bool = True,
3132
) -> None:
3233
BasePostgrestClient.__init__(
3334
self,
3435
base_url,
3536
schema=schema,
3637
headers=headers,
3738
timeout=timeout,
39+
verify=verify,
3840
)
3941
self.session = cast(AsyncClient, self.session)
4042

@@ -43,11 +45,13 @@ def create_session(
4345
base_url: str,
4446
headers: Dict[str, str],
4547
timeout: Union[int, float, Timeout],
48+
verify: bool = True,
4649
) -> AsyncClient:
4750
return AsyncClient(
4851
base_url=base_url,
4952
headers=headers,
5053
timeout=timeout,
54+
verify=verify,
5155
follow_redirects=True,
5256
)
5357

postgrest/_sync/client.py

+4
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@ def __init__(
2828
schema: str = "public",
2929
headers: Dict[str, str] = DEFAULT_POSTGREST_CLIENT_HEADERS,
3030
timeout: Union[int, float, Timeout] = DEFAULT_POSTGREST_CLIENT_TIMEOUT,
31+
verify: bool = True,
3132
) -> None:
3233
BasePostgrestClient.__init__(
3334
self,
3435
base_url,
3536
schema=schema,
3637
headers=headers,
3738
timeout=timeout,
39+
verify=verify,
3840
)
3941
self.session = cast(SyncClient, self.session)
4042

@@ -43,11 +45,13 @@ def create_session(
4345
base_url: str,
4446
headers: Dict[str, str],
4547
timeout: Union[int, float, Timeout],
48+
verify: bool = True,
4649
) -> SyncClient:
4750
return SyncClient(
4851
base_url=base_url,
4952
headers=headers,
5053
timeout=timeout,
54+
verify=verify,
5155
follow_redirects=True,
5256
)
5357

postgrest/base_client.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,22 @@ def __init__(
1818
schema: str,
1919
headers: Dict[str, str],
2020
timeout: Union[int, float, Timeout],
21+
verify: bool = True,
2122
) -> None:
2223
headers = {
2324
**headers,
2425
"Accept-Profile": schema,
2526
"Content-Profile": schema,
2627
}
27-
self.session = self.create_session(base_url, headers, timeout)
28+
self.session = self.create_session(base_url, headers, timeout, verify)
2829

2930
@abstractmethod
3031
def create_session(
3132
self,
3233
base_url: str,
3334
headers: Dict[str, str],
3435
timeout: Union[int, float, Timeout],
36+
verify: bool = True,
3537
) -> Union[SyncClient, AsyncClient]:
3638
raise NotImplementedError()
3739

0 commit comments

Comments
 (0)