supabase_auth 2.4.2__tar.gz → 2.4.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/PKG-INFO +1 -1
  2. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/pyproject.toml +7 -7
  3. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/supabase_auth/__init__.py +1 -1
  4. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/supabase_auth/_async/gotrue_admin_api.py +7 -3
  5. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/supabase_auth/_async/gotrue_base_api.py +5 -7
  6. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/supabase_auth/_async/gotrue_client.py +2 -0
  7. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/supabase_auth/_async/storage.py +3 -6
  8. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/supabase_auth/_sync/api.py +10 -9
  9. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/supabase_auth/_sync/client.py +4 -0
  10. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/supabase_auth/_sync/gotrue_admin_api.py +7 -3
  11. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/supabase_auth/_sync/gotrue_base_api.py +5 -7
  12. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/supabase_auth/_sync/gotrue_client.py +2 -0
  13. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/supabase_auth/_sync/storage.py +3 -6
  14. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/supabase_auth/helpers.py +5 -5
  15. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/LICENSE +0 -0
  16. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/README.md +0 -0
  17. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/supabase_auth/_async/__init__.py +0 -0
  18. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/supabase_auth/_async/gotrue_admin_mfa_api.py +0 -0
  19. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/supabase_auth/_async/gotrue_mfa_api.py +0 -0
  20. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/supabase_auth/_sync/__init__.py +0 -0
  21. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/supabase_auth/_sync/gotrue_admin_mfa_api.py +0 -0
  22. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/supabase_auth/_sync/gotrue_mfa_api.py +0 -0
  23. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/supabase_auth/constants.py +0 -0
  24. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/supabase_auth/errors.py +0 -0
  25. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/supabase_auth/http_clients.py +0 -0
  26. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/supabase_auth/timer.py +0 -0
  27. {supabase_auth-2.4.2 → supabase_auth-2.4.3}/supabase_auth/types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: supabase_auth
3
- Version: 2.4.2
3
+ Version: 2.4.3
4
4
  Summary: Python Client Library for Supabase Auth
5
5
  Home-page: https://github.com/supabase-community/auth-py
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "supabase_auth"
3
- version = "2.4.2"
3
+ version = "2.4.3"
4
4
  description = "Python Client Library for Supabase Auth"
5
5
  authors = ["Joel Lee <joel@joellee.org>"]
6
6
  homepage = "https://github.com/supabase-community/auth-py"
@@ -20,17 +20,17 @@ httpx = ">=0.23,<0.28"
20
20
  pydantic = ">=1.10,<3"
21
21
 
22
22
  [tool.poetry.dev-dependencies]
23
- pytest = "^8.1.0"
23
+ pytest = "^8.2.1"
24
24
  flake8 = "^5.0.4"
25
- black = "^24.3.0"
25
+ black = "^24.4.2"
26
26
  isort = "^5.12.0"
27
27
  pre-commit = "^3.4.0"
28
- pytest-cov = "^4.0.0"
28
+ pytest-cov = "^5.0.0"
29
29
  pytest-depends = "^1.0.1"
30
- pytest-asyncio = "^0.23.5"
31
- Faker = "^23.3.0"
30
+ pytest-asyncio = "^0.23.7"
31
+ Faker = "^25.2.0"
32
32
  unasync-cli = "^0.0.9"
33
- python-semantic-release = "^9.1.1"
33
+ python-semantic-release = "^9.8.0"
34
34
 
35
35
  [tool.poetry.group.dev.dependencies]
36
36
  pygithub = ">=1.57,<3.0"
@@ -1,6 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "2.4.2"
3
+ __version__ = "2.4.3"
4
4
 
5
5
  from ._async.gotrue_admin_api import AsyncGoTrueAdminAPI # type: ignore # noqa: F401
6
6
  from ._async.gotrue_client import AsyncGoTrueClient # type: ignore # noqa: F401
@@ -29,12 +29,14 @@ class AsyncGoTrueAdminAPI(AsyncGoTrueBaseAPI):
29
29
  url: str = "",
30
30
  headers: Dict[str, str] = {},
31
31
  http_client: Union[AsyncClient, None] = None,
32
+ verify: bool = True,
32
33
  ) -> None:
33
34
  AsyncGoTrueBaseAPI.__init__(
34
35
  self,
35
36
  url=url,
36
37
  headers=headers,
37
38
  http_client=http_client,
39
+ verify=verify,
38
40
  )
39
41
  self.mfa = AsyncGoTrueAdminMFAAPI()
40
42
  self.mfa.list_factors = self._list_factors
@@ -113,9 +115,11 @@ class AsyncGoTrueAdminAPI(AsyncGoTrueBaseAPI):
113
115
  "GET",
114
116
  "admin/users",
115
117
  query={"page": page, "per_page": per_page},
116
- xform=lambda data: [model_validate(User, user) for user in data["users"]]
117
- if "users" in data
118
- else [],
118
+ xform=lambda data: (
119
+ [model_validate(User, user) for user in data["users"]]
120
+ if "users" in data
121
+ else []
122
+ ),
119
123
  )
120
124
 
121
125
  async def get_user_by_id(self, uid: str) -> UserResponse:
@@ -19,10 +19,11 @@ class AsyncGoTrueBaseAPI:
19
19
  url: str,
20
20
  headers: Dict[str, str],
21
21
  http_client: Union[AsyncClient, None],
22
+ verify: bool = True,
22
23
  ):
23
24
  self._url = url
24
25
  self._headers = headers
25
- self._http_client = http_client or AsyncClient()
26
+ self._http_client = http_client or AsyncClient(verify=bool(verify))
26
27
 
27
28
  async def __aenter__(self) -> Self:
28
29
  return self
@@ -46,8 +47,7 @@ class AsyncGoTrueBaseAPI:
46
47
  body: Union[Any, None] = None,
47
48
  no_resolve_json: Literal[False] = False,
48
49
  xform: Callable[[Any], T],
49
- ) -> T:
50
- ... # pragma: no cover
50
+ ) -> T: ... # pragma: no cover
51
51
 
52
52
  @overload
53
53
  async def _request(
@@ -62,8 +62,7 @@ class AsyncGoTrueBaseAPI:
62
62
  body: Union[Any, None] = None,
63
63
  no_resolve_json: Literal[True],
64
64
  xform: Callable[[Response], T],
65
- ) -> T:
66
- ... # pragma: no cover
65
+ ) -> T: ... # pragma: no cover
67
66
 
68
67
  @overload
69
68
  async def _request(
@@ -77,8 +76,7 @@ class AsyncGoTrueBaseAPI:
77
76
  query: Union[Dict[str, str], None] = None,
78
77
  body: Union[Any, None] = None,
79
78
  no_resolve_json: bool = False,
80
- ) -> None:
81
- ... # pragma: no cover
79
+ ) -> None: ... # pragma: no cover
82
80
 
83
81
  async def _request(
84
82
  self,
@@ -89,12 +89,14 @@ class AsyncGoTrueClient(AsyncGoTrueBaseAPI):
89
89
  storage: Union[AsyncSupportedStorage, None] = None,
90
90
  http_client: Union[AsyncClient, None] = None,
91
91
  flow_type: AuthFlowType = "implicit",
92
+ verify: bool = True,
92
93
  ) -> None:
93
94
  AsyncGoTrueBaseAPI.__init__(
94
95
  self,
95
96
  url=url or GOTRUE_URL,
96
97
  headers=headers or DEFAULT_HEADERS,
97
98
  http_client=http_client,
99
+ verify=verify,
98
100
  )
99
101
  self._storage_key = storage_key or STORAGE_KEY
100
102
  self._auto_refresh_token = auto_refresh_token
@@ -6,16 +6,13 @@ from typing import Dict, Optional
6
6
 
7
7
  class AsyncSupportedStorage(ABC):
8
8
  @abstractmethod
9
- async def get_item(self, key: str) -> Optional[str]:
10
- ... # pragma: no cover
9
+ async def get_item(self, key: str) -> Optional[str]: ... # pragma: no cover
11
10
 
12
11
  @abstractmethod
13
- async def set_item(self, key: str, value: str) -> None:
14
- ... # pragma: no cover
12
+ async def set_item(self, key: str, value: str) -> None: ... # pragma: no cover
15
13
 
16
14
  @abstractmethod
17
- async def remove_item(self, key: str) -> None:
18
- ... # pragma: no cover
15
+ async def remove_item(self, key: str) -> None: ... # pragma: no cover
19
16
 
20
17
 
21
18
  class AsyncMemoryStorage(AsyncSupportedStorage):
@@ -26,12 +26,13 @@ class SyncGoTrueAPI:
26
26
  headers: Dict[str, str],
27
27
  cookie_options: CookieOptions,
28
28
  http_client: Optional[SyncClient] = None,
29
+ verify: bool = True,
29
30
  ) -> None:
30
31
  """Initialise API class."""
31
32
  self.url = url
32
33
  self.headers = headers
33
34
  self.cookie_options = cookie_options
34
- self.http_client = http_client or SyncClient()
35
+ self.http_client = http_client or SyncClient(verify=bool(verify))
35
36
 
36
37
  def __enter__(self) -> SyncGoTrueAPI:
37
38
  return self
@@ -136,8 +137,8 @@ class SyncGoTrueAPI:
136
137
  data = {"email": email, "password": password, "data": data}
137
138
  url = f"{self.url}/signup{query_string}"
138
139
  response = self.http_client.post(url, json=data, headers=headers)
139
- SessionOrUserModel = determine_session_or_user_model_from_response(response)
140
- return SessionOrUserModel.parse_response(response)
140
+ session_or_user_model = determine_session_or_user_model_from_response(response)
141
+ return session_or_user_model.parse_response(response)
141
142
 
142
143
  def sign_in_with_email(
143
144
  self,
@@ -211,8 +212,8 @@ class SyncGoTrueAPI:
211
212
  data = {"phone": phone, "password": password, "data": data}
212
213
  url = f"{self.url}/signup"
213
214
  response = self.http_client.post(url, json=data, headers=headers)
214
- SessionOrUserModel = determine_session_or_user_model_from_response(response)
215
- return SessionOrUserModel.parse_response(response)
215
+ session_or_user_model = determine_session_or_user_model_from_response(response)
216
+ return session_or_user_model.parse_response(response)
216
217
 
217
218
  def sign_in_with_phone(
218
219
  self,
@@ -335,8 +336,8 @@ class SyncGoTrueAPI:
335
336
  data["redirect_to"] = redirect_to_encoded
336
337
  url = f"{self.url}/verify"
337
338
  response = self.http_client.post(url, json=data, headers=headers)
338
- SessionOrUserModel = determine_session_or_user_model_from_response(response)
339
- return SessionOrUserModel.parse_response(response)
339
+ session_or_user_model = determine_session_or_user_model_from_response(response)
340
+ return session_or_user_model.parse_response(response)
340
341
 
341
342
  def invite_user_by_email(
342
343
  self,
@@ -637,8 +638,8 @@ class SyncGoTrueAPI:
637
638
  data["redirect_to"] = redirect_to_encoded
638
639
  url = f"{self.url}/admin/generate_link"
639
640
  response = self.http_client.post(url, json=data, headers=headers)
640
- SessionOrUserModel = determine_session_or_user_model_from_response(response)
641
- return SessionOrUserModel.parse_response(response)
641
+ session_or_user_model = determine_session_or_user_model_from_response(response)
642
+ return session_or_user_model.parse_response(response)
642
643
 
643
644
  def set_auth_cookie(self, *, req, res):
644
645
  """Stub for parity with JS api."""
@@ -37,6 +37,7 @@ class SyncGoTrueClient:
37
37
  cookie_options: CookieOptions = CookieOptions.parse_obj(COOKIE_OPTIONS),
38
38
  api: Optional[SyncGoTrueAPI] = None,
39
39
  replace_default_headers: bool = False,
40
+ verify: bool = True,
40
41
  ) -> None:
41
42
  """Create a new client
42
43
 
@@ -54,6 +55,8 @@ class SyncGoTrueClient:
54
55
  The storage engine to use for persisting the session.
55
56
  cookie_options : CookieOptions
56
57
  The options for the cookie.
58
+ verify: bool
59
+ Verify SSL, True by default, False disables verification.
57
60
  """
58
61
  if url.startswith("http://"):
59
62
  print(
@@ -72,6 +75,7 @@ class SyncGoTrueClient:
72
75
  "url": url,
73
76
  "headers": {**empty_or_default_headers, **headers},
74
77
  "cookie_options": cookie_options,
78
+ "verify": verify,
75
79
  }
76
80
  self.api = api or SyncGoTrueAPI(**args)
77
81
 
@@ -29,12 +29,14 @@ class SyncGoTrueAdminAPI(SyncGoTrueBaseAPI):
29
29
  url: str = "",
30
30
  headers: Dict[str, str] = {},
31
31
  http_client: Union[SyncClient, None] = None,
32
+ verify: bool = True,
32
33
  ) -> None:
33
34
  SyncGoTrueBaseAPI.__init__(
34
35
  self,
35
36
  url=url,
36
37
  headers=headers,
37
38
  http_client=http_client,
39
+ verify=verify,
38
40
  )
39
41
  self.mfa = SyncGoTrueAdminMFAAPI()
40
42
  self.mfa.list_factors = self._list_factors
@@ -113,9 +115,11 @@ class SyncGoTrueAdminAPI(SyncGoTrueBaseAPI):
113
115
  "GET",
114
116
  "admin/users",
115
117
  query={"page": page, "per_page": per_page},
116
- xform=lambda data: [model_validate(User, user) for user in data["users"]]
117
- if "users" in data
118
- else [],
118
+ xform=lambda data: (
119
+ [model_validate(User, user) for user in data["users"]]
120
+ if "users" in data
121
+ else []
122
+ ),
119
123
  )
120
124
 
121
125
  def get_user_by_id(self, uid: str) -> UserResponse:
@@ -19,10 +19,11 @@ class SyncGoTrueBaseAPI:
19
19
  url: str,
20
20
  headers: Dict[str, str],
21
21
  http_client: Union[SyncClient, None],
22
+ verify: bool = True,
22
23
  ):
23
24
  self._url = url
24
25
  self._headers = headers
25
- self._http_client = http_client or SyncClient()
26
+ self._http_client = http_client or SyncClient(verify=bool(verify))
26
27
 
27
28
  def __enter__(self) -> Self:
28
29
  return self
@@ -46,8 +47,7 @@ class SyncGoTrueBaseAPI:
46
47
  body: Union[Any, None] = None,
47
48
  no_resolve_json: Literal[False] = False,
48
49
  xform: Callable[[Any], T],
49
- ) -> T:
50
- ... # pragma: no cover
50
+ ) -> T: ... # pragma: no cover
51
51
 
52
52
  @overload
53
53
  def _request(
@@ -62,8 +62,7 @@ class SyncGoTrueBaseAPI:
62
62
  body: Union[Any, None] = None,
63
63
  no_resolve_json: Literal[True],
64
64
  xform: Callable[[Response], T],
65
- ) -> T:
66
- ... # pragma: no cover
65
+ ) -> T: ... # pragma: no cover
67
66
 
68
67
  @overload
69
68
  def _request(
@@ -77,8 +76,7 @@ class SyncGoTrueBaseAPI:
77
76
  query: Union[Dict[str, str], None] = None,
78
77
  body: Union[Any, None] = None,
79
78
  no_resolve_json: bool = False,
80
- ) -> None:
81
- ... # pragma: no cover
79
+ ) -> None: ... # pragma: no cover
82
80
 
83
81
  def _request(
84
82
  self,
@@ -89,12 +89,14 @@ class SyncGoTrueClient(SyncGoTrueBaseAPI):
89
89
  storage: Union[SyncSupportedStorage, None] = None,
90
90
  http_client: Union[SyncClient, None] = None,
91
91
  flow_type: AuthFlowType = "implicit",
92
+ verify: bool = True,
92
93
  ) -> None:
93
94
  SyncGoTrueBaseAPI.__init__(
94
95
  self,
95
96
  url=url or GOTRUE_URL,
96
97
  headers=headers or DEFAULT_HEADERS,
97
98
  http_client=http_client,
99
+ verify=verify,
98
100
  )
99
101
  self._storage_key = storage_key or STORAGE_KEY
100
102
  self._auto_refresh_token = auto_refresh_token
@@ -6,16 +6,13 @@ from typing import Dict, Optional
6
6
 
7
7
  class SyncSupportedStorage(ABC):
8
8
  @abstractmethod
9
- def get_item(self, key: str) -> Optional[str]:
10
- ... # pragma: no cover
9
+ def get_item(self, key: str) -> Optional[str]: ... # pragma: no cover
11
10
 
12
11
  @abstractmethod
13
- def set_item(self, key: str, value: str) -> None:
14
- ... # pragma: no cover
12
+ def set_item(self, key: str, value: str) -> None: ... # pragma: no cover
15
13
 
16
14
  @abstractmethod
17
- def remove_item(self, key: str) -> None:
18
- ... # pragma: no cover
15
+ def remove_item(self, key: str) -> None: ... # pragma: no cover
19
16
 
20
17
 
21
18
  class SyncMemoryStorage(SyncSupportedStorage):
@@ -103,8 +103,8 @@ def parse_sso_response(data: Any) -> SSOResponse:
103
103
 
104
104
  def get_error_message(error: Any) -> str:
105
105
  props = ["msg", "message", "error_description", "error"]
106
- filter = (
107
- lambda prop: prop in error if isinstance(error, dict) else hasattr(error, prop)
106
+ filter = lambda prop: (
107
+ prop in error if isinstance(error, dict) else hasattr(error, prop)
108
108
  )
109
109
  return next((error[prop] for prop in props if filter(prop)), str(error))
110
110
 
@@ -133,11 +133,11 @@ def decode_jwt_payload(token: str) -> Any:
133
133
  parts = token.split(".")
134
134
  if len(parts) != 3:
135
135
  raise ValueError("JWT is not valid: not a JWT structure")
136
- base64Url = parts[1]
136
+ base64url = parts[1]
137
137
  # Addding padding otherwise the following error happens:
138
138
  # binascii.Error: Incorrect padding
139
- base64UrlWithPadding = base64Url + "=" * (-len(base64Url) % 4)
140
- return loads(urlsafe_b64decode(base64UrlWithPadding).decode("utf-8"))
139
+ base64url_with_padding = base64url + "=" * (-len(base64url) % 4)
140
+ return loads(urlsafe_b64decode(base64url_with_padding).decode("utf-8"))
141
141
 
142
142
 
143
143
  def generate_pkce_verifier(length=64):
File without changes
File without changes