Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit 574d615

Browse files
feat: Proxy support (#600)
1 parent c865a98 commit 574d615

File tree

8 files changed

+24
-6
lines changed

8 files changed

+24
-6
lines changed

supabase_auth/_async/gotrue_admin_api.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
from functools import partial
4-
from typing import Dict, List, Union
4+
from typing import Dict, List, Optional, Union
55

66
from ..helpers import model_validate, parse_link_response, parse_user_response
77
from ..http_clients import AsyncClient
@@ -30,13 +30,15 @@ def __init__(
3030
headers: Dict[str, str] = {},
3131
http_client: Union[AsyncClient, None] = None,
3232
verify: bool = True,
33+
proxy: Optional[str] = None,
3334
) -> None:
3435
AsyncGoTrueBaseAPI.__init__(
3536
self,
3637
url=url,
3738
headers=headers,
3839
http_client=http_client,
3940
verify=verify,
41+
proxy=proxy,
4042
)
4143
self.mfa = AsyncGoTrueAdminMFAAPI()
4244
self.mfa.list_factors = self._list_factors

supabase_auth/_async/gotrue_base_api.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Any, Callable, Dict, TypeVar, Union, overload
3+
from typing import Any, Callable, Dict, Optional, TypeVar, Union, overload
44

55
from httpx import Response
66
from pydantic import BaseModel
@@ -21,11 +21,13 @@ def __init__(
2121
headers: Dict[str, str],
2222
http_client: Union[AsyncClient, None],
2323
verify: bool = True,
24+
proxy: Optional[str] = None,
2425
):
2526
self._url = url
2627
self._headers = headers
2728
self._http_client = http_client or AsyncClient(
2829
verify=bool(verify),
30+
proxy=proxy,
2931
follow_redirects=True,
3032
http2=True,
3133
)

supabase_auth/_async/gotrue_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from functools import partial
55
from json import loads
66
from time import time
7-
from typing import Callable, Dict, List, Tuple, Union
7+
from typing import Callable, Dict, List, Optional, Tuple, Union
88
from urllib.parse import parse_qs, urlencode, urlparse
99
from uuid import uuid4
1010

@@ -96,13 +96,15 @@ def __init__(
9696
http_client: Union[AsyncClient, None] = None,
9797
flow_type: AuthFlowType = "implicit",
9898
verify: bool = True,
99+
proxy: Optional[str] = None,
99100
) -> None:
100101
AsyncGoTrueBaseAPI.__init__(
101102
self,
102103
url=url or GOTRUE_URL,
103104
headers=headers or DEFAULT_HEADERS,
104105
http_client=http_client,
105106
verify=verify,
107+
proxy=proxy,
106108
)
107109
self._storage_key = storage_key or STORAGE_KEY
108110
self._auto_refresh_token = auto_refresh_token

supabase_auth/_sync/api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@ def __init__(
2727
cookie_options: CookieOptions,
2828
http_client: Optional[SyncClient] = None,
2929
verify: bool = True,
30+
proxy: Optional[str] = None,
3031
) -> None:
3132
"""Initialise API class."""
3233
self.url = url
3334
self.headers = headers
3435
self.cookie_options = cookie_options
3536
self.http_client = http_client or SyncClient(
3637
verify=bool(verify),
38+
proxy=proxy,
3739
follow_redirects=True,
3840
http2=True,
3941
)

supabase_auth/_sync/client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def __init__(
3838
api: Optional[SyncGoTrueAPI] = None,
3939
replace_default_headers: bool = False,
4040
verify: bool = True,
41+
proxy: Optional[str] = None,
4142
) -> None:
4243
"""Create a new client
4344
@@ -57,6 +58,8 @@ def __init__(
5758
The options for the cookie.
5859
verify: bool
5960
Verify SSL, True by default, False disables verification.
61+
proxy: str
62+
HTTP Proxy string or None, None by default, None disables proxy.
6063
"""
6164
if url.startswith("http://"):
6265
print(
@@ -76,6 +79,7 @@ def __init__(
7679
"headers": {**empty_or_default_headers, **headers},
7780
"cookie_options": cookie_options,
7881
"verify": verify,
82+
"proxy": proxy,
7983
}
8084
self.api = api or SyncGoTrueAPI(**args)
8185

supabase_auth/_sync/gotrue_admin_api.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
from functools import partial
4-
from typing import Dict, List, Union
4+
from typing import Dict, List, Optional, Union
55

66
from ..helpers import model_validate, parse_link_response, parse_user_response
77
from ..http_clients import SyncClient
@@ -30,13 +30,15 @@ def __init__(
3030
headers: Dict[str, str] = {},
3131
http_client: Union[SyncClient, None] = None,
3232
verify: bool = True,
33+
proxy: Optional[str] = None,
3334
) -> None:
3435
SyncGoTrueBaseAPI.__init__(
3536
self,
3637
url=url,
3738
headers=headers,
3839
http_client=http_client,
3940
verify=verify,
41+
proxy=proxy,
4042
)
4143
self.mfa = SyncGoTrueAdminMFAAPI()
4244
self.mfa.list_factors = self._list_factors

supabase_auth/_sync/gotrue_base_api.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Any, Callable, Dict, TypeVar, Union, overload
3+
from typing import Any, Callable, Dict, Optional, TypeVar, Union, overload
44

55
from httpx import Response
66
from pydantic import BaseModel
@@ -21,11 +21,13 @@ def __init__(
2121
headers: Dict[str, str],
2222
http_client: Union[SyncClient, None],
2323
verify: bool = True,
24+
proxy: Optional[str] = None,
2425
):
2526
self._url = url
2627
self._headers = headers
2728
self._http_client = http_client or SyncClient(
2829
verify=bool(verify),
30+
proxy=proxy,
2931
follow_redirects=True,
3032
http2=True,
3133
)

supabase_auth/_sync/gotrue_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from functools import partial
55
from json import loads
66
from time import time
7-
from typing import Callable, Dict, List, Tuple, Union
7+
from typing import Callable, Dict, List, Optional, Tuple, Union
88
from urllib.parse import parse_qs, urlencode, urlparse
99
from uuid import uuid4
1010

@@ -96,13 +96,15 @@ def __init__(
9696
http_client: Union[SyncClient, None] = None,
9797
flow_type: AuthFlowType = "implicit",
9898
verify: bool = True,
99+
proxy: Optional[str] = None,
99100
) -> None:
100101
SyncGoTrueBaseAPI.__init__(
101102
self,
102103
url=url or GOTRUE_URL,
103104
headers=headers or DEFAULT_HEADERS,
104105
http_client=http_client,
105106
verify=verify,
107+
proxy=proxy,
106108
)
107109
self._storage_key = storage_key or STORAGE_KEY
108110
self._auto_refresh_token = auto_refresh_token

0 commit comments

Comments
 (0)