Skip to content

Commit 2a89a7c

Browse files
feat: Proxy support (#950)
Co-authored-by: Andrew Smith <[email protected]>
1 parent f04f5c9 commit 2a89a7c

File tree

6 files changed

+29
-11
lines changed

6 files changed

+29
-11
lines changed

poetry.lock

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ python = "^3.9"
1919
postgrest = "^0.17.0"
2020
realtime = "^2.0.0"
2121
gotrue = "^2.7.0"
22-
httpx = ">=0.24,<0.28"
22+
httpx = ">=0.26,<0.28"
2323
storage3 = "^0.8.0"
2424
supafunc = "^0.6.0"
2525
typing-extensions = "^4.12.2"

supabase/_async/auth_client.py

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def __init__(
2424
http_client: Optional[AsyncClient] = None,
2525
flow_type: AuthFlowType = "implicit",
2626
verify: bool = True,
27+
proxy: Optional[str] = None,
2728
):
2829
"""Instantiate SupabaseAuthClient instance."""
2930
if headers is None:
@@ -40,4 +41,5 @@ def __init__(
4041
http_client=http_client,
4142
flow_type=flow_type,
4243
verify=verify,
44+
proxy=proxy,
4345
)

supabase/_async/client.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,18 @@ def _init_storage_client(
231231
headers: Dict[str, str],
232232
storage_client_timeout: int = DEFAULT_STORAGE_CLIENT_TIMEOUT,
233233
verify: bool = True,
234+
proxy: Optional[str] = None,
234235
) -> AsyncStorageClient:
235-
return AsyncStorageClient(storage_url, headers, storage_client_timeout, verify)
236+
return AsyncStorageClient(
237+
storage_url, headers, storage_client_timeout, verify, proxy
238+
)
236239

237240
@staticmethod
238241
def _init_supabase_auth_client(
239242
auth_url: str,
240243
client_options: ClientOptions,
241244
verify: bool = True,
245+
proxy: Optional[str] = None,
242246
) -> AsyncSupabaseAuthClient:
243247
"""Creates a wrapped instance of the GoTrue Client."""
244248
return AsyncSupabaseAuthClient(
@@ -249,6 +253,7 @@ def _init_supabase_auth_client(
249253
headers=client_options.headers,
250254
flow_type=client_options.flow_type,
251255
verify=verify,
256+
proxy=proxy,
252257
)
253258

254259
@staticmethod
@@ -258,6 +263,7 @@ def _init_postgrest_client(
258263
schema: str,
259264
timeout: Union[int, float, Timeout] = DEFAULT_POSTGREST_CLIENT_TIMEOUT,
260265
verify: bool = True,
266+
proxy: Optional[str] = None,
261267
) -> AsyncPostgrestClient:
262268
"""Private helper for creating an instance of the Postgrest client."""
263269
return AsyncPostgrestClient(
@@ -266,6 +272,7 @@ def _init_postgrest_client(
266272
schema=schema,
267273
timeout=timeout,
268274
verify=verify,
275+
proxy=proxy,
269276
)
270277

271278
def _create_auth_header(self, token: str):

supabase/_sync/auth_client.py

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def __init__(
2424
http_client: Optional[SyncClient] = None,
2525
flow_type: AuthFlowType = "implicit",
2626
verify: bool = True,
27+
proxy: Optional[str] = None,
2728
):
2829
"""Instantiate SupabaseAuthClient instance."""
2930
if headers is None:
@@ -40,4 +41,5 @@ def __init__(
4041
http_client=http_client,
4142
flow_type=flow_type,
4243
verify=verify,
44+
proxy=proxy,
4345
)

supabase/_sync/client.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,18 @@ def _init_storage_client(
230230
headers: Dict[str, str],
231231
storage_client_timeout: int = DEFAULT_STORAGE_CLIENT_TIMEOUT,
232232
verify: bool = True,
233+
proxy: Optional[str] = None,
233234
) -> SyncStorageClient:
234-
return SyncStorageClient(storage_url, headers, storage_client_timeout, verify)
235+
return SyncStorageClient(
236+
storage_url, headers, storage_client_timeout, verify, proxy
237+
)
235238

236239
@staticmethod
237240
def _init_supabase_auth_client(
238241
auth_url: str,
239242
client_options: ClientOptions,
240243
verify: bool = True,
244+
proxy: Optional[str] = None,
241245
) -> SyncSupabaseAuthClient:
242246
"""Creates a wrapped instance of the GoTrue Client."""
243247
return SyncSupabaseAuthClient(
@@ -248,6 +252,7 @@ def _init_supabase_auth_client(
248252
headers=client_options.headers,
249253
flow_type=client_options.flow_type,
250254
verify=verify,
255+
proxy=proxy,
251256
)
252257

253258
@staticmethod
@@ -257,6 +262,7 @@ def _init_postgrest_client(
257262
schema: str,
258263
timeout: Union[int, float, Timeout] = DEFAULT_POSTGREST_CLIENT_TIMEOUT,
259264
verify: bool = True,
265+
proxy: Optional[str] = None,
260266
) -> SyncPostgrestClient:
261267
"""Private helper for creating an instance of the Postgrest client."""
262268
return SyncPostgrestClient(
@@ -265,6 +271,7 @@ def _init_postgrest_client(
265271
schema=schema,
266272
timeout=timeout,
267273
verify=verify,
274+
proxy=proxy,
268275
)
269276

270277
def _create_auth_header(self, token: str):

0 commit comments

Comments
 (0)