Skip to content

feat: Proxy support #950

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ python = "^3.9"
postgrest = "^0.17.0"
realtime = "^2.0.0"
gotrue = "^2.7.0"
httpx = ">=0.24,<0.28"
httpx = ">=0.26,<0.28"
storage3 = "^0.8.0"
supafunc = "^0.6.0"
typing-extensions = "^4.12.2"
Expand Down
2 changes: 2 additions & 0 deletions supabase/_async/auth_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(
http_client: Optional[AsyncClient] = None,
flow_type: AuthFlowType = "implicit",
verify: bool = True,
proxy: Optional[str] = None,
):
"""Instantiate SupabaseAuthClient instance."""
if headers is None:
Expand All @@ -40,4 +41,5 @@ def __init__(
http_client=http_client,
flow_type=flow_type,
verify=verify,
proxy=proxy,
)
9 changes: 8 additions & 1 deletion supabase/_async/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,18 @@ def _init_storage_client(
headers: Dict[str, str],
storage_client_timeout: int = DEFAULT_STORAGE_CLIENT_TIMEOUT,
verify: bool = True,
proxy: Optional[str] = None,
) -> AsyncStorageClient:
return AsyncStorageClient(storage_url, headers, storage_client_timeout, verify)
return AsyncStorageClient(
storage_url, headers, storage_client_timeout, verify, proxy
)

@staticmethod
def _init_supabase_auth_client(
auth_url: str,
client_options: ClientOptions,
verify: bool = True,
proxy: Optional[str] = None,
) -> AsyncSupabaseAuthClient:
"""Creates a wrapped instance of the GoTrue Client."""
return AsyncSupabaseAuthClient(
Expand All @@ -249,6 +253,7 @@ def _init_supabase_auth_client(
headers=client_options.headers,
flow_type=client_options.flow_type,
verify=verify,
proxy=proxy,
)

@staticmethod
Expand All @@ -258,6 +263,7 @@ def _init_postgrest_client(
schema: str,
timeout: Union[int, float, Timeout] = DEFAULT_POSTGREST_CLIENT_TIMEOUT,
verify: bool = True,
proxy: Optional[str] = None,
) -> AsyncPostgrestClient:
"""Private helper for creating an instance of the Postgrest client."""
return AsyncPostgrestClient(
Expand All @@ -266,6 +272,7 @@ def _init_postgrest_client(
schema=schema,
timeout=timeout,
verify=verify,
proxy=proxy,
)

def _create_auth_header(self, token: str):
Expand Down
2 changes: 2 additions & 0 deletions supabase/_sync/auth_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(
http_client: Optional[SyncClient] = None,
flow_type: AuthFlowType = "implicit",
verify: bool = True,
proxy: Optional[str] = None,
):
"""Instantiate SupabaseAuthClient instance."""
if headers is None:
Expand All @@ -40,4 +41,5 @@ def __init__(
http_client=http_client,
flow_type=flow_type,
verify=verify,
proxy=proxy,
)
9 changes: 8 additions & 1 deletion supabase/_sync/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,18 @@ def _init_storage_client(
headers: Dict[str, str],
storage_client_timeout: int = DEFAULT_STORAGE_CLIENT_TIMEOUT,
verify: bool = True,
proxy: Optional[str] = None,
) -> SyncStorageClient:
return SyncStorageClient(storage_url, headers, storage_client_timeout, verify)
return SyncStorageClient(
storage_url, headers, storage_client_timeout, verify, proxy
)

@staticmethod
def _init_supabase_auth_client(
auth_url: str,
client_options: ClientOptions,
verify: bool = True,
proxy: Optional[str] = None,
) -> SyncSupabaseAuthClient:
"""Creates a wrapped instance of the GoTrue Client."""
return SyncSupabaseAuthClient(
Expand All @@ -248,6 +252,7 @@ def _init_supabase_auth_client(
headers=client_options.headers,
flow_type=client_options.flow_type,
verify=verify,
proxy=proxy,
)

@staticmethod
Expand All @@ -257,6 +262,7 @@ def _init_postgrest_client(
schema: str,
timeout: Union[int, float, Timeout] = DEFAULT_POSTGREST_CLIENT_TIMEOUT,
verify: bool = True,
proxy: Optional[str] = None,
) -> SyncPostgrestClient:
"""Private helper for creating an instance of the Postgrest client."""
return SyncPostgrestClient(
Expand All @@ -265,6 +271,7 @@ def _init_postgrest_client(
schema=schema,
timeout=timeout,
verify=verify,
proxy=proxy,
)

def _create_auth_header(self, token: str):
Expand Down