From 41063165e54953e529d2c38dd15b1a3a1cb363bd Mon Sep 17 00:00:00 2001 From: rishabhpoddar Date: Thu, 9 Nov 2023 20:36:27 +0530 Subject: [PATCH] adding dev-v0.16.8 tag to this commit to ensure building --- html/supertokens_python/asyncio/index.html | 114 ++++-- html/supertokens_python/constants.html | 2 +- html/supertokens_python/querier.html | 346 ++++++++++++++++-- .../recipe/dashboard/api/analytics.html | 8 +- .../recipe/dashboard/api/index.html | 16 +- .../recipe/dashboard/api/search/getTags.html | 4 +- .../recipe/dashboard/api/signin.html | 2 + .../recipe/dashboard/api/signout.html | 2 + .../api/userdetails/user_delete.html | 4 +- .../recipe/dashboard/api/users_count_get.html | 10 +- .../recipe/dashboard/api/users_get.html | 2 + .../dashboard/recipe_implementation.html | 3 + .../emailpassword/recipe_implementation.html | 72 ++-- .../recipe_implementation.html | 39 +- .../recipe/jwt/recipe_implementation.html | 24 +- .../multitenancy/recipe_implementation.html | 27 ++ .../passwordless/recipe_implementation.html | 180 ++++++--- .../recipe/session/recipe_implementation.html | 72 ++-- .../recipe/session/session_functions.html | 102 ++++-- .../thirdparty/recipe_implementation.html | 60 ++- .../usermetadata/recipe_implementation.html | 36 +- .../userroles/recipe_implementation.html | 84 ++++- html/supertokens_python/supertokens.html | 206 ++++++++--- html/supertokens_python/syncio/index.html | 126 +++++-- 24 files changed, 1213 insertions(+), 328 deletions(-) diff --git a/html/supertokens_python/asyncio/index.html b/html/supertokens_python/asyncio/index.html index 468e19788..176740f64 100644 --- a/html/supertokens_python/asyncio/index.html +++ b/html/supertokens_python/asyncio/index.html @@ -39,7 +39,7 @@

Module supertokens_python.asyncio

# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, Union, Any from supertokens_python import Supertokens from supertokens_python.interfaces import ( @@ -61,9 +61,16 @@

Module supertokens_python.asyncio

pagination_token: Union[str, None] = None, include_recipe_ids: Union[None, List[str]] = None, query: Union[None, Dict[str, str]] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> UsersResponse: return await Supertokens.get_instance().get_users( - tenant_id, "ASC", limit, pagination_token, include_recipe_ids, query + tenant_id, + "ASC", + limit, + pagination_token, + include_recipe_ids, + query, + user_context, ) @@ -73,22 +80,33 @@

Module supertokens_python.asyncio

pagination_token: Union[str, None] = None, include_recipe_ids: Union[None, List[str]] = None, query: Union[None, Dict[str, str]] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> UsersResponse: return await Supertokens.get_instance().get_users( - tenant_id, "DESC", limit, pagination_token, include_recipe_ids, query + tenant_id, + "DESC", + limit, + pagination_token, + include_recipe_ids, + query, + user_context, ) async def get_user_count( - include_recipe_ids: Union[None, List[str]] = None, tenant_id: Optional[str] = None + include_recipe_ids: Union[None, List[str]] = None, + tenant_id: Optional[str] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> int: return await Supertokens.get_instance().get_user_count( - include_recipe_ids, tenant_id + include_recipe_ids, tenant_id, user_context ) -async def delete_user(user_id: str) -> None: - return await Supertokens.get_instance().delete_user(user_id) +async def delete_user( + user_id: str, user_context: Optional[Dict[str, Any]] = None +) -> None: + return await Supertokens.get_instance().delete_user(user_id, user_context) async def create_user_id_mapping( @@ -96,30 +114,39 @@

Module supertokens_python.asyncio

external_user_id: str, external_user_id_info: Optional[str] = None, force: Optional[bool] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> Union[ CreateUserIdMappingOkResult, UnknownSupertokensUserIDError, UserIdMappingAlreadyExistsError, ]: return await Supertokens.get_instance().create_user_id_mapping( - supertokens_user_id, external_user_id, external_user_id_info, force + supertokens_user_id, + external_user_id, + external_user_id_info, + force, + user_context, ) async def get_user_id_mapping( user_id: str, user_id_type: Optional[UserIDTypes] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> Union[GetUserIdMappingOkResult, UnknownMappingError]: - return await Supertokens.get_instance().get_user_id_mapping(user_id, user_id_type) + return await Supertokens.get_instance().get_user_id_mapping( + user_id, user_id_type, user_context + ) async def delete_user_id_mapping( user_id: str, user_id_type: Optional[UserIDTypes] = None, force: Optional[bool] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> DeleteUserIdMappingOkResult: return await Supertokens.get_instance().delete_user_id_mapping( - user_id, user_id_type, force + user_id, user_id_type, force, user_context ) @@ -127,9 +154,10 @@

Module supertokens_python.asyncio

user_id: str, user_id_type: Optional[UserIDTypes] = None, external_user_id_info: Optional[str] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> Union[UpdateOrDeleteUserIdMappingInfoOkResult, UnknownMappingError]: return await Supertokens.get_instance().update_or_delete_user_id_mapping_info( - user_id, user_id_type, external_user_id_info + user_id, user_id_type, external_user_id_info, user_context ) @@ -141,7 +169,7 @@

Module supertokens_python.asyncio

Functions

-async def create_user_id_mapping(supertokens_user_id: str, external_user_id: str, external_user_id_info: Optional[str] = None, force: Optional[bool] = None) ‑> Union[CreateUserIdMappingOkResultUnknownSupertokensUserIDErrorUserIdMappingAlreadyExistsError] +async def create_user_id_mapping(supertokens_user_id: str, external_user_id: str, external_user_id_info: Optional[str] = None, force: Optional[bool] = None, user_context: Optional[Dict[str, Any]] = None) ‑> Union[CreateUserIdMappingOkResultUnknownSupertokensUserIDErrorUserIdMappingAlreadyExistsError]
@@ -154,18 +182,23 @@

Functions

external_user_id: str, external_user_id_info: Optional[str] = None, force: Optional[bool] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> Union[ CreateUserIdMappingOkResult, UnknownSupertokensUserIDError, UserIdMappingAlreadyExistsError, ]: return await Supertokens.get_instance().create_user_id_mapping( - supertokens_user_id, external_user_id, external_user_id_info, force + supertokens_user_id, + external_user_id, + external_user_id_info, + force, + user_context, )
-async def delete_user(user_id: str) ‑> None +async def delete_user(user_id: str, user_context: Optional[Dict[str, Any]] = None) ‑> None
@@ -173,12 +206,14 @@

Functions

Expand source code -
async def delete_user(user_id: str) -> None:
-    return await Supertokens.get_instance().delete_user(user_id)
+
async def delete_user(
+    user_id: str, user_context: Optional[Dict[str, Any]] = None
+) -> None:
+    return await Supertokens.get_instance().delete_user(user_id, user_context)
-async def delete_user_id_mapping(user_id: str, user_id_type: Optional[Literal['SUPERTOKENS', 'EXTERNAL', 'ANY']] = None, force: Optional[bool] = None) ‑> DeleteUserIdMappingOkResult +async def delete_user_id_mapping(user_id: str, user_id_type: Optional[Literal['SUPERTOKENS', 'EXTERNAL', 'ANY']] = None, force: Optional[bool] = None, user_context: Optional[Dict[str, Any]] = None) ‑> DeleteUserIdMappingOkResult
@@ -190,14 +225,15 @@

Functions

user_id: str, user_id_type: Optional[UserIDTypes] = None, force: Optional[bool] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> DeleteUserIdMappingOkResult: return await Supertokens.get_instance().delete_user_id_mapping( - user_id, user_id_type, force + user_id, user_id_type, force, user_context )
-async def get_user_count(include_recipe_ids: Optional[None] = None, tenant_id: Optional[str] = None) ‑> int +async def get_user_count(include_recipe_ids: Optional[None] = None, tenant_id: Optional[str] = None, user_context: Optional[Dict[str, Any]] = None) ‑> int
@@ -206,15 +242,17 @@

Functions

Expand source code
async def get_user_count(
-    include_recipe_ids: Union[None, List[str]] = None, tenant_id: Optional[str] = None
+    include_recipe_ids: Union[None, List[str]] = None,
+    tenant_id: Optional[str] = None,
+    user_context: Optional[Dict[str, Any]] = None,
 ) -> int:
     return await Supertokens.get_instance().get_user_count(
-        include_recipe_ids, tenant_id
+        include_recipe_ids, tenant_id, user_context
     )
-async def get_user_id_mapping(user_id: str, user_id_type: Optional[Literal['SUPERTOKENS', 'EXTERNAL', 'ANY']] = None) ‑> Union[GetUserIdMappingOkResultUnknownMappingError] +async def get_user_id_mapping(user_id: str, user_id_type: Optional[Literal['SUPERTOKENS', 'EXTERNAL', 'ANY']] = None, user_context: Optional[Dict[str, Any]] = None) ‑> Union[GetUserIdMappingOkResultUnknownMappingError]
@@ -225,12 +263,15 @@

Functions

async def get_user_id_mapping(
     user_id: str,
     user_id_type: Optional[UserIDTypes] = None,
+    user_context: Optional[Dict[str, Any]] = None,
 ) -> Union[GetUserIdMappingOkResult, UnknownMappingError]:
-    return await Supertokens.get_instance().get_user_id_mapping(user_id, user_id_type)
+ return await Supertokens.get_instance().get_user_id_mapping( + user_id, user_id_type, user_context + )
-async def get_users_newest_first(tenant_id: str, limit: Optional[int] = None, pagination_token: Optional[str] = None, include_recipe_ids: Optional[None] = None, query: Optional[None] = None) ‑> UsersResponse +async def get_users_newest_first(tenant_id: str, limit: Optional[int] = None, pagination_token: Optional[str] = None, include_recipe_ids: Optional[None] = None, query: Optional[None] = None, user_context: Optional[Dict[str, Any]] = None) ‑> UsersResponse
@@ -244,14 +285,21 @@

Functions

pagination_token: Union[str, None] = None, include_recipe_ids: Union[None, List[str]] = None, query: Union[None, Dict[str, str]] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> UsersResponse: return await Supertokens.get_instance().get_users( - tenant_id, "DESC", limit, pagination_token, include_recipe_ids, query + tenant_id, + "DESC", + limit, + pagination_token, + include_recipe_ids, + query, + user_context, )
-async def get_users_oldest_first(tenant_id: str, limit: Optional[int] = None, pagination_token: Optional[str] = None, include_recipe_ids: Optional[None] = None, query: Optional[None] = None) ‑> UsersResponse +async def get_users_oldest_first(tenant_id: str, limit: Optional[int] = None, pagination_token: Optional[str] = None, include_recipe_ids: Optional[None] = None, query: Optional[None] = None, user_context: Optional[Dict[str, Any]] = None) ‑> UsersResponse
@@ -265,14 +313,21 @@

Functions

pagination_token: Union[str, None] = None, include_recipe_ids: Union[None, List[str]] = None, query: Union[None, Dict[str, str]] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> UsersResponse: return await Supertokens.get_instance().get_users( - tenant_id, "ASC", limit, pagination_token, include_recipe_ids, query + tenant_id, + "ASC", + limit, + pagination_token, + include_recipe_ids, + query, + user_context, )
-async def update_or_delete_user_id_mapping_info(user_id: str, user_id_type: Optional[Literal['SUPERTOKENS', 'EXTERNAL', 'ANY']] = None, external_user_id_info: Optional[str] = None) ‑> Union[UpdateOrDeleteUserIdMappingInfoOkResultUnknownMappingError] +async def update_or_delete_user_id_mapping_info(user_id: str, user_id_type: Optional[Literal['SUPERTOKENS', 'EXTERNAL', 'ANY']] = None, external_user_id_info: Optional[str] = None, user_context: Optional[Dict[str, Any]] = None) ‑> Union[UpdateOrDeleteUserIdMappingInfoOkResultUnknownMappingError]
@@ -284,9 +339,10 @@

Functions

user_id: str, user_id_type: Optional[UserIDTypes] = None, external_user_id_info: Optional[str] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> Union[UpdateOrDeleteUserIdMappingInfoOkResult, UnknownMappingError]: return await Supertokens.get_instance().update_or_delete_user_id_mapping_info( - user_id, user_id_type, external_user_id_info + user_id, user_id_type, external_user_id_info, user_context )
diff --git a/html/supertokens_python/constants.html b/html/supertokens_python/constants.html index 122262218..f498da4ef 100644 --- a/html/supertokens_python/constants.html +++ b/html/supertokens_python/constants.html @@ -42,7 +42,7 @@

Module supertokens_python.constants

from __future__ import annotations SUPPORTED_CDI_VERSIONS = ["3.0"] -VERSION = "0.16.7" +VERSION = "0.16.8" TELEMETRY = "/telemetry" USER_COUNT = "/users/count" USER_DELETE = "/user/remove" diff --git a/html/supertokens_python/querier.html b/html/supertokens_python/querier.html index f72a45249..1f5aa0540 100644 --- a/html/supertokens_python/querier.html +++ b/html/supertokens_python/querier.html @@ -42,10 +42,9 @@

Module supertokens_python.querier

from __future__ import annotations import asyncio - from json import JSONDecodeError from os import environ -from typing import TYPE_CHECKING, Any, Awaitable, Callable, Dict, Optional +from typing import TYPE_CHECKING, Any, Awaitable, Callable, Dict, Optional, Tuple from httpx import AsyncClient, ConnectTimeout, NetworkError, Response @@ -78,6 +77,25 @@

Module supertokens_python.querier

api_version = None __last_tried_index: int = 0 __hosts_alive_for_testing: Set[str] = set() + network_interceptor: Optional[ + Callable[ + [ + str, + str, + Dict[str, Any], + Optional[Dict[str, Any]], + Optional[Dict[str, Any]], + Optional[Dict[str, Any]], + ], + Tuple[ + str, + str, + Dict[str, Any], + Optional[Dict[str, Any]], + Optional[Dict[str, Any]], + ], + ] + ] = None def __init__(self, hosts: List[Host], rid_to_core: Union[None, str] = None): self.__hosts = hosts @@ -169,7 +187,29 @@

Module supertokens_python.querier

return Querier(Querier.__hosts, rid_to_core) @staticmethod - def init(hosts: List[Host], api_key: Union[str, None] = None): + def init( + hosts: List[Host], + api_key: Union[str, None] = None, + network_interceptor: Optional[ + Callable[ + [ + str, + str, + Dict[str, Any], + Optional[Dict[str, Any]], + Optional[Dict[str, Any]], + Optional[Dict[str, Any]], + ], + Tuple[ + str, + str, + Dict[str, Any], + Optional[Dict[str, Any]], + Optional[Dict[str, Any]], + ], + ] + ] = None, + ): if not Querier.__init_called: Querier.__init_called = True Querier.__hosts = hosts @@ -177,6 +217,7 @@

Module supertokens_python.querier

Querier.api_version = None Querier.__last_tried_index = 0 Querier.__hosts_alive_for_testing = set() + Querier.network_interceptor = network_interceptor async def __get_headers_with_api_version(self, path: NormalisedURLPath): headers = {API_VERSION_HEADER: await self.get_api_version()} @@ -187,17 +228,33 @@

Module supertokens_python.querier

return headers async def send_get_request( - self, path: NormalisedURLPath, params: Union[Dict[str, Any], None] = None + self, + path: NormalisedURLPath, + params: Union[Dict[str, Any], None], + user_context: Union[Dict[str, Any], None], ) -> Dict[str, Any]: if params is None: params = {} async def f(url: str, method: str) -> Response: + headers = await self.__get_headers_with_api_version(path) + nonlocal params + if Querier.network_interceptor is not None: + ( + url, + method, + headers, + params, + _, + ) = Querier.network_interceptor( # pylint:disable=not-callable + url, method, headers, params, {}, user_context + ) + return await self.api_request( url, method, 2, - headers=await self.__get_headers_with_api_version(path), + headers=headers, params=params, ) @@ -206,7 +263,8 @@

Module supertokens_python.querier

async def send_post_request( self, path: NormalisedURLPath, - data: Union[Dict[str, Any], None] = None, + data: Union[Dict[str, Any], None], + user_context: Union[Dict[str, Any], None], test: bool = False, ) -> Dict[str, Any]: if data is None: @@ -223,35 +281,64 @@

Module supertokens_python.querier

headers["content-type"] = "application/json; charset=utf-8" async def f(url: str, method: str) -> Response: + nonlocal headers, data + if Querier.network_interceptor is not None: + ( + url, + method, + headers, + _, + data, + ) = Querier.network_interceptor( # pylint:disable=not-callable + url, method, headers, {}, data, user_context + ) return await self.api_request( url, method, 2, - headers=await self.__get_headers_with_api_version(path), + headers=headers, json=data, ) return await self.__send_request_helper(path, "POST", f, len(self.__hosts)) async def send_delete_request( - self, path: NormalisedURLPath, params: Union[Dict[str, Any], None] = None + self, + path: NormalisedURLPath, + params: Union[Dict[str, Any], None], + user_context: Union[Dict[str, Any], None], ) -> Dict[str, Any]: if params is None: params = {} async def f(url: str, method: str) -> Response: + headers = await self.__get_headers_with_api_version(path) + nonlocal params + if Querier.network_interceptor is not None: + ( + url, + method, + headers, + params, + _, + ) = Querier.network_interceptor( # pylint:disable=not-callable + url, method, headers, params, {}, user_context + ) return await self.api_request( url, method, 2, - headers=await self.__get_headers_with_api_version(path), + headers=headers, params=params, ) return await self.__send_request_helper(path, "DELETE", f, len(self.__hosts)) async def send_put_request( - self, path: NormalisedURLPath, data: Union[Dict[str, Any], None] = None + self, + path: NormalisedURLPath, + data: Union[Dict[str, Any], None], + user_context: Union[Dict[str, Any], None], ) -> Dict[str, Any]: if data is None: data = {} @@ -260,6 +347,17 @@

Module supertokens_python.querier

headers["content-type"] = "application/json; charset=utf-8" async def f(url: str, method: str) -> Response: + nonlocal headers, data + if Querier.network_interceptor is not None: + ( + url, + method, + headers, + _, + data, + ) = Querier.network_interceptor( # pylint:disable=not-callable + url, method, headers, {}, data, user_context + ) return await self.api_request(url, method, 2, headers=headers, json=data) return await self.__send_request_helper(path, "PUT", f, len(self.__hosts)) @@ -392,6 +490,25 @@

Classes

api_version = None __last_tried_index: int = 0 __hosts_alive_for_testing: Set[str] = set() + network_interceptor: Optional[ + Callable[ + [ + str, + str, + Dict[str, Any], + Optional[Dict[str, Any]], + Optional[Dict[str, Any]], + Optional[Dict[str, Any]], + ], + Tuple[ + str, + str, + Dict[str, Any], + Optional[Dict[str, Any]], + Optional[Dict[str, Any]], + ], + ] + ] = None def __init__(self, hosts: List[Host], rid_to_core: Union[None, str] = None): self.__hosts = hosts @@ -483,7 +600,29 @@

Classes

return Querier(Querier.__hosts, rid_to_core) @staticmethod - def init(hosts: List[Host], api_key: Union[str, None] = None): + def init( + hosts: List[Host], + api_key: Union[str, None] = None, + network_interceptor: Optional[ + Callable[ + [ + str, + str, + Dict[str, Any], + Optional[Dict[str, Any]], + Optional[Dict[str, Any]], + Optional[Dict[str, Any]], + ], + Tuple[ + str, + str, + Dict[str, Any], + Optional[Dict[str, Any]], + Optional[Dict[str, Any]], + ], + ] + ] = None, + ): if not Querier.__init_called: Querier.__init_called = True Querier.__hosts = hosts @@ -491,6 +630,7 @@

Classes

Querier.api_version = None Querier.__last_tried_index = 0 Querier.__hosts_alive_for_testing = set() + Querier.network_interceptor = network_interceptor async def __get_headers_with_api_version(self, path: NormalisedURLPath): headers = {API_VERSION_HEADER: await self.get_api_version()} @@ -501,17 +641,33 @@

Classes

return headers async def send_get_request( - self, path: NormalisedURLPath, params: Union[Dict[str, Any], None] = None + self, + path: NormalisedURLPath, + params: Union[Dict[str, Any], None], + user_context: Union[Dict[str, Any], None], ) -> Dict[str, Any]: if params is None: params = {} async def f(url: str, method: str) -> Response: + headers = await self.__get_headers_with_api_version(path) + nonlocal params + if Querier.network_interceptor is not None: + ( + url, + method, + headers, + params, + _, + ) = Querier.network_interceptor( # pylint:disable=not-callable + url, method, headers, params, {}, user_context + ) + return await self.api_request( url, method, 2, - headers=await self.__get_headers_with_api_version(path), + headers=headers, params=params, ) @@ -520,7 +676,8 @@

Classes

async def send_post_request( self, path: NormalisedURLPath, - data: Union[Dict[str, Any], None] = None, + data: Union[Dict[str, Any], None], + user_context: Union[Dict[str, Any], None], test: bool = False, ) -> Dict[str, Any]: if data is None: @@ -537,35 +694,64 @@

Classes

headers["content-type"] = "application/json; charset=utf-8" async def f(url: str, method: str) -> Response: + nonlocal headers, data + if Querier.network_interceptor is not None: + ( + url, + method, + headers, + _, + data, + ) = Querier.network_interceptor( # pylint:disable=not-callable + url, method, headers, {}, data, user_context + ) return await self.api_request( url, method, 2, - headers=await self.__get_headers_with_api_version(path), + headers=headers, json=data, ) return await self.__send_request_helper(path, "POST", f, len(self.__hosts)) async def send_delete_request( - self, path: NormalisedURLPath, params: Union[Dict[str, Any], None] = None + self, + path: NormalisedURLPath, + params: Union[Dict[str, Any], None], + user_context: Union[Dict[str, Any], None], ) -> Dict[str, Any]: if params is None: params = {} async def f(url: str, method: str) -> Response: + headers = await self.__get_headers_with_api_version(path) + nonlocal params + if Querier.network_interceptor is not None: + ( + url, + method, + headers, + params, + _, + ) = Querier.network_interceptor( # pylint:disable=not-callable + url, method, headers, params, {}, user_context + ) return await self.api_request( url, method, 2, - headers=await self.__get_headers_with_api_version(path), + headers=headers, params=params, ) return await self.__send_request_helper(path, "DELETE", f, len(self.__hosts)) async def send_put_request( - self, path: NormalisedURLPath, data: Union[Dict[str, Any], None] = None + self, + path: NormalisedURLPath, + data: Union[Dict[str, Any], None], + user_context: Union[Dict[str, Any], None], ) -> Dict[str, Any]: if data is None: data = {} @@ -574,6 +760,17 @@

Classes

headers["content-type"] = "application/json; charset=utf-8" async def f(url: str, method: str) -> Response: + nonlocal headers, data + if Querier.network_interceptor is not None: + ( + url, + method, + headers, + _, + data, + ) = Querier.network_interceptor( # pylint:disable=not-callable + url, method, headers, {}, data, user_context + ) return await self.api_request(url, method, 2, headers=headers, json=data) return await self.__send_request_helper(path, "PUT", f, len(self.__hosts)) @@ -685,6 +882,10 @@

Class variables

+
var network_interceptor : Optional[Callable[[str, str, Dict[str, Any], Optional[Dict[str, Any]], Optional[Dict[str, Any]], Optional[Dict[str, Any]]], Tuple[str, str, Dict[str, Any], Optional[Dict[str, Any]], Optional[Dict[str, Any]]]]]
+
+
+

Static methods

@@ -725,7 +926,7 @@

Static methods

-def init(hosts: List[Host], api_key: Union[str, None] = None) +def init(hosts: List[Host], api_key: Union[str, None] = None, network_interceptor: Optional[Callable[[str, str, Dict[str, Any], Optional[Dict[str, Any]], Optional[Dict[str, Any]], Optional[Dict[str, Any]]], Tuple[str, str, Dict[str, Any], Optional[Dict[str, Any]], Optional[Dict[str, Any]]]]] = None)
@@ -734,14 +935,37 @@

Static methods

Expand source code
@staticmethod
-def init(hosts: List[Host], api_key: Union[str, None] = None):
+def init(
+    hosts: List[Host],
+    api_key: Union[str, None] = None,
+    network_interceptor: Optional[
+        Callable[
+            [
+                str,
+                str,
+                Dict[str, Any],
+                Optional[Dict[str, Any]],
+                Optional[Dict[str, Any]],
+                Optional[Dict[str, Any]],
+            ],
+            Tuple[
+                str,
+                str,
+                Dict[str, Any],
+                Optional[Dict[str, Any]],
+                Optional[Dict[str, Any]],
+            ],
+        ]
+    ] = None,
+):
     if not Querier.__init_called:
         Querier.__init_called = True
         Querier.__hosts = hosts
         Querier.__api_key = api_key
         Querier.api_version = None
         Querier.__last_tried_index = 0
-        Querier.__hosts_alive_for_testing = set()
+ Querier.__hosts_alive_for_testing = set() + Querier.network_interceptor = network_interceptor
@@ -874,7 +1098,7 @@

Methods

-async def send_delete_request(self, path: NormalisedURLPath, params: Union[Dict[str, Any], None] = None) ‑> Dict[str, Any] +async def send_delete_request(self, path: NormalisedURLPath, params: Union[Dict[str, Any], None], user_context: Union[Dict[str, Any], None]) ‑> Dict[str, Any]
@@ -883,17 +1107,32 @@

Methods

Expand source code
async def send_delete_request(
-    self, path: NormalisedURLPath, params: Union[Dict[str, Any], None] = None
+    self,
+    path: NormalisedURLPath,
+    params: Union[Dict[str, Any], None],
+    user_context: Union[Dict[str, Any], None],
 ) -> Dict[str, Any]:
     if params is None:
         params = {}
 
     async def f(url: str, method: str) -> Response:
+        headers = await self.__get_headers_with_api_version(path)
+        nonlocal params
+        if Querier.network_interceptor is not None:
+            (
+                url,
+                method,
+                headers,
+                params,
+                _,
+            ) = Querier.network_interceptor(  # pylint:disable=not-callable
+                url, method, headers, params, {}, user_context
+            )
         return await self.api_request(
             url,
             method,
             2,
-            headers=await self.__get_headers_with_api_version(path),
+            headers=headers,
             params=params,
         )
 
@@ -901,7 +1140,7 @@ 

Methods

-async def send_get_request(self, path: NormalisedURLPath, params: Union[Dict[str, Any], None] = None) ‑> Dict[str, Any] +async def send_get_request(self, path: NormalisedURLPath, params: Union[Dict[str, Any], None], user_context: Union[Dict[str, Any], None]) ‑> Dict[str, Any]
@@ -910,17 +1149,33 @@

Methods

Expand source code
async def send_get_request(
-    self, path: NormalisedURLPath, params: Union[Dict[str, Any], None] = None
+    self,
+    path: NormalisedURLPath,
+    params: Union[Dict[str, Any], None],
+    user_context: Union[Dict[str, Any], None],
 ) -> Dict[str, Any]:
     if params is None:
         params = {}
 
     async def f(url: str, method: str) -> Response:
+        headers = await self.__get_headers_with_api_version(path)
+        nonlocal params
+        if Querier.network_interceptor is not None:
+            (
+                url,
+                method,
+                headers,
+                params,
+                _,
+            ) = Querier.network_interceptor(  # pylint:disable=not-callable
+                url, method, headers, params, {}, user_context
+            )
+
         return await self.api_request(
             url,
             method,
             2,
-            headers=await self.__get_headers_with_api_version(path),
+            headers=headers,
             params=params,
         )
 
@@ -928,7 +1183,7 @@ 

Methods

-async def send_post_request(self, path: NormalisedURLPath, data: Union[Dict[str, Any], None] = None, test: bool = False) ‑> Dict[str, Any] +async def send_post_request(self, path: NormalisedURLPath, data: Union[Dict[str, Any], None], user_context: Union[Dict[str, Any], None], test: bool = False) ‑> Dict[str, Any]
@@ -939,7 +1194,8 @@

Methods

async def send_post_request(
     self,
     path: NormalisedURLPath,
-    data: Union[Dict[str, Any], None] = None,
+    data: Union[Dict[str, Any], None],
+    user_context: Union[Dict[str, Any], None],
     test: bool = False,
 ) -> Dict[str, Any]:
     if data is None:
@@ -956,11 +1212,22 @@ 

Methods

headers["content-type"] = "application/json; charset=utf-8" async def f(url: str, method: str) -> Response: + nonlocal headers, data + if Querier.network_interceptor is not None: + ( + url, + method, + headers, + _, + data, + ) = Querier.network_interceptor( # pylint:disable=not-callable + url, method, headers, {}, data, user_context + ) return await self.api_request( url, method, 2, - headers=await self.__get_headers_with_api_version(path), + headers=headers, json=data, ) @@ -968,7 +1235,7 @@

Methods

-async def send_put_request(self, path: NormalisedURLPath, data: Union[Dict[str, Any], None] = None) ‑> Dict[str, Any] +async def send_put_request(self, path: NormalisedURLPath, data: Union[Dict[str, Any], None], user_context: Union[Dict[str, Any], None]) ‑> Dict[str, Any]
@@ -977,7 +1244,10 @@

Methods

Expand source code
async def send_put_request(
-    self, path: NormalisedURLPath, data: Union[Dict[str, Any], None] = None
+    self,
+    path: NormalisedURLPath,
+    data: Union[Dict[str, Any], None],
+    user_context: Union[Dict[str, Any], None],
 ) -> Dict[str, Any]:
     if data is None:
         data = {}
@@ -986,6 +1256,17 @@ 

Methods

headers["content-type"] = "application/json; charset=utf-8" async def f(url: str, method: str) -> Response: + nonlocal headers, data + if Querier.network_interceptor is not None: + ( + url, + method, + headers, + _, + data, + ) = Querier.network_interceptor( # pylint:disable=not-callable + url, method, headers, {}, data, user_context + ) return await self.api_request(url, method, 2, headers=headers, json=data) return await self.__send_request_helper(path, "PUT", f, len(self.__hosts))
@@ -1019,6 +1300,7 @@

get_hosts_alive_for_testing
  • get_instance
  • init
  • +
  • network_interceptor
  • reset
  • send_delete_request
  • send_get_request
  • diff --git a/html/supertokens_python/recipe/dashboard/api/analytics.html b/html/supertokens_python/recipe/dashboard/api/analytics.html index 589dca2d8..17c9da55f 100644 --- a/html/supertokens_python/recipe/dashboard/api/analytics.html +++ b/html/supertokens_python/recipe/dashboard/api/analytics.html @@ -85,7 +85,9 @@

    Module supertokens_python.recipe.dashboard.api.analytics try: response = await Querier.get_instance().send_get_request( - NormalisedURLPath("/telemetry") + NormalisedURLPath("/telemetry"), + None, + _user_context, ) if response is not None: if ( @@ -176,7 +178,9 @@

    Functions

    try: response = await Querier.get_instance().send_get_request( - NormalisedURLPath("/telemetry") + NormalisedURLPath("/telemetry"), + None, + _user_context, ) if response is not None: if ( diff --git a/html/supertokens_python/recipe/dashboard/api/index.html b/html/supertokens_python/recipe/dashboard/api/index.html index 8fee3206a..ce9518d17 100644 --- a/html/supertokens_python/recipe/dashboard/api/index.html +++ b/html/supertokens_python/recipe/dashboard/api/index.html @@ -216,7 +216,9 @@

    Functions

    try: response = await Querier.get_instance().send_get_request( - NormalisedURLPath("/telemetry") + NormalisedURLPath("/telemetry"), + None, + _user_context, ) if response is not None: if ( @@ -352,6 +354,7 @@

    Functions

    response = await Querier.get_instance().send_post_request( NormalisedURLPath("/recipe/dashboard/signin"), {"email": email, "password": password}, + user_context=_user_context, ) if "status" in response and response["status"] == "OK": @@ -396,6 +399,7 @@

    Functions

    await Querier.get_instance().send_delete_request( NormalisedURLPath("/recipe/dashboard/session"), {"sessionId": session_id_form_auth_header}, + user_context=_user_context, ) return SignOutOK()
    @@ -413,7 +417,7 @@

    Functions

    _: APIInterface, _tenant_id: str, __: APIOptions, _user_context: Dict[str, Any] ) -> SearchTagsOK: response = await Querier.get_instance().send_get_request( - NormalisedURLPath("/user/search/tags") + NormalisedURLPath("/user/search/tags"), None, _user_context ) return SearchTagsOK(tags=response["tags"])
    @@ -601,7 +605,7 @@

    Functions

    if user_id is None: raise_bad_input_exception("Missing required parameter 'userId'") - await Supertokens.get_instance().delete_user(user_id) + await Supertokens.get_instance().delete_user(user_id, _user_context) return UserDeleteAPIResponse()
    @@ -1014,7 +1018,10 @@

    Functions

    _api_options: APIOptions, _user_context: Dict[str, Any], ) -> UserCountGetAPIResponse: - count = await Supertokens.get_instance().get_user_count(None, tenant_id) + count = await Supertokens.get_instance().get_user_count( + None, + tenant_id, + ) return UserCountGetAPIResponse(count=count)
    @@ -1054,6 +1061,7 @@

    Functions

    pagination_token=pagination_token, include_recipe_ids=None, query=api_options.request.get_query_params(), + user_context=user_context, ) # user metadata bulk fetch with batches: diff --git a/html/supertokens_python/recipe/dashboard/api/search/getTags.html b/html/supertokens_python/recipe/dashboard/api/search/getTags.html index 2b3d61036..cefc743c7 100644 --- a/html/supertokens_python/recipe/dashboard/api/search/getTags.html +++ b/html/supertokens_python/recipe/dashboard/api/search/getTags.html @@ -55,7 +55,7 @@

    Module supertokens_python.recipe.dashboard.api.search.ge _: APIInterface, _tenant_id: str, __: APIOptions, _user_context: Dict[str, Any] ) -> SearchTagsOK: response = await Querier.get_instance().send_get_request( - NormalisedURLPath("/user/search/tags") + NormalisedURLPath("/user/search/tags"), None, _user_context ) return SearchTagsOK(tags=response["tags"]) @@ -80,7 +80,7 @@

    Functions

    _: APIInterface, _tenant_id: str, __: APIOptions, _user_context: Dict[str, Any] ) -> SearchTagsOK: response = await Querier.get_instance().send_get_request( - NormalisedURLPath("/user/search/tags") + NormalisedURLPath("/user/search/tags"), None, _user_context ) return SearchTagsOK(tags=response["tags"]) diff --git a/html/supertokens_python/recipe/dashboard/api/signin.html b/html/supertokens_python/recipe/dashboard/api/signin.html index 6b928d2f9..508a1f47f 100644 --- a/html/supertokens_python/recipe/dashboard/api/signin.html +++ b/html/supertokens_python/recipe/dashboard/api/signin.html @@ -68,6 +68,7 @@

    Module supertokens_python.recipe.dashboard.api.signinFunctions

    response = await Querier.get_instance().send_post_request( NormalisedURLPath("/recipe/dashboard/signin"), {"email": email, "password": password}, + user_context=_user_context, ) if "status" in response and response["status"] == "OK": diff --git a/html/supertokens_python/recipe/dashboard/api/signout.html b/html/supertokens_python/recipe/dashboard/api/signout.html index 695632449..ed886c577 100644 --- a/html/supertokens_python/recipe/dashboard/api/signout.html +++ b/html/supertokens_python/recipe/dashboard/api/signout.html @@ -70,6 +70,7 @@

    Module supertokens_python.recipe.dashboard.api.signout @@ -107,6 +108,7 @@

    Functions

    await Querier.get_instance().send_delete_request( NormalisedURLPath("/recipe/dashboard/session"), {"sessionId": session_id_form_auth_header}, + user_context=_user_context, ) return SignOutOK()
    diff --git a/html/supertokens_python/recipe/dashboard/api/userdetails/user_delete.html b/html/supertokens_python/recipe/dashboard/api/userdetails/user_delete.html index fe3dac57a..0bb3f956f 100644 --- a/html/supertokens_python/recipe/dashboard/api/userdetails/user_delete.html +++ b/html/supertokens_python/recipe/dashboard/api/userdetails/user_delete.html @@ -44,7 +44,7 @@

    Module supertokens_python.recipe.dashboard.api.userdetai if user_id is None: raise_bad_input_exception("Missing required parameter 'userId'") - await Supertokens.get_instance().delete_user(user_id) + await Supertokens.get_instance().delete_user(user_id, _user_context) return UserDeleteAPIResponse() @@ -76,7 +76,7 @@

    Functions

    if user_id is None: raise_bad_input_exception("Missing required parameter 'userId'") - await Supertokens.get_instance().delete_user(user_id) + await Supertokens.get_instance().delete_user(user_id, _user_context) return UserDeleteAPIResponse()
    diff --git a/html/supertokens_python/recipe/dashboard/api/users_count_get.html b/html/supertokens_python/recipe/dashboard/api/users_count_get.html index 2deca95f9..5e7a5c477 100644 --- a/html/supertokens_python/recipe/dashboard/api/users_count_get.html +++ b/html/supertokens_python/recipe/dashboard/api/users_count_get.html @@ -59,7 +59,10 @@

    Module supertokens_python.recipe.dashboard.api.users_cou _api_options: APIOptions, _user_context: Dict[str, Any], ) -> UserCountGetAPIResponse: - count = await Supertokens.get_instance().get_user_count(None, tenant_id) + count = await Supertokens.get_instance().get_user_count( + None, + tenant_id, + ) return UserCountGetAPIResponse(count=count) @@ -85,7 +88,10 @@

    Functions

    _api_options: APIOptions, _user_context: Dict[str, Any], ) -> UserCountGetAPIResponse: - count = await Supertokens.get_instance().get_user_count(None, tenant_id) + count = await Supertokens.get_instance().get_user_count( + None, + tenant_id, + ) return UserCountGetAPIResponse(count=count) diff --git a/html/supertokens_python/recipe/dashboard/api/users_get.html b/html/supertokens_python/recipe/dashboard/api/users_get.html index 01877b4fe..fc984b181 100644 --- a/html/supertokens_python/recipe/dashboard/api/users_get.html +++ b/html/supertokens_python/recipe/dashboard/api/users_get.html @@ -89,6 +89,7 @@

    Module supertokens_python.recipe.dashboard.api.users_get pagination_token=pagination_token, include_recipe_ids=None, query=api_options.request.get_query_params(), + user_context=user_context, ) # user metadata bulk fetch with batches: @@ -187,6 +188,7 @@

    Functions

    pagination_token=pagination_token, include_recipe_ids=None, query=api_options.request.get_query_params(), + user_context=user_context, ) # user metadata bulk fetch with batches: diff --git a/html/supertokens_python/recipe/dashboard/recipe_implementation.html b/html/supertokens_python/recipe/dashboard/recipe_implementation.html index 6da507de2..c44d25aa6 100644 --- a/html/supertokens_python/recipe/dashboard/recipe_implementation.html +++ b/html/supertokens_python/recipe/dashboard/recipe_implementation.html @@ -79,6 +79,7 @@

    Module supertokens_python.recipe.dashboard.recipe_implem await Querier.get_instance().send_post_request( NormalisedURLPath("/recipe/dashboard/session/verify"), {"sessionId": auth_header_value}, + user_context=user_context, ) ) if session_verification_response.get("status") != "OK": @@ -165,6 +166,7 @@

    Classes

    await Querier.get_instance().send_post_request( NormalisedURLPath("/recipe/dashboard/session/verify"), {"sessionId": auth_header_value}, + user_context=user_context, ) ) if session_verification_response.get("status") != "OK": @@ -256,6 +258,7 @@

    Methods

    await Querier.get_instance().send_post_request( NormalisedURLPath("/recipe/dashboard/session/verify"), {"sessionId": auth_header_value}, + user_context=user_context, ) ) if session_verification_response.get("status") != "OK": diff --git a/html/supertokens_python/recipe/emailpassword/recipe_implementation.html b/html/supertokens_python/recipe/emailpassword/recipe_implementation.html index 20281fb35..07603572a 100644 --- a/html/supertokens_python/recipe/emailpassword/recipe_implementation.html +++ b/html/supertokens_python/recipe/emailpassword/recipe_implementation.html @@ -83,7 +83,7 @@

    Module supertokens_python.recipe.emailpassword.recipe_im ) -> Union[User, None]: params = {"userId": user_id} response = await self.querier.send_get_request( - NormalisedURLPath("/recipe/user"), params + NormalisedURLPath("/recipe/user"), params, user_context ) if "status" in response and response["status"] == "OK": return User( @@ -99,7 +99,7 @@

    Module supertokens_python.recipe.emailpassword.recipe_im ) -> Union[User, None]: params = {"email": email} response = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/user"), params + NormalisedURLPath(f"{tenant_id}/recipe/user"), params, user_context ) if "status" in response and response["status"] == "OK": return User( @@ -115,7 +115,9 @@

    Module supertokens_python.recipe.emailpassword.recipe_im ) -> Union[CreateResetPasswordOkResult, CreateResetPasswordWrongUserIdError]: data = {"userId": user_id} response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/user/password/reset/token"), data + NormalisedURLPath(f"{tenant_id}/recipe/user/password/reset/token"), + data, + user_context=user_context, ) if "status" in response and response["status"] == "OK": return CreateResetPasswordOkResult(response["token"]) @@ -132,7 +134,9 @@

    Module supertokens_python.recipe.emailpassword.recipe_im ]: data = {"method": "token", "token": token, "newPassword": new_password} response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/user/password/reset"), data + NormalisedURLPath(f"{tenant_id}/recipe/user/password/reset"), + data, + user_context=user_context, ) if "status" not in response or response["status"] != "OK": return ResetPasswordUsingTokenInvalidTokenError() @@ -146,7 +150,9 @@

    Module supertokens_python.recipe.emailpassword.recipe_im ) -> Union[SignInOkResult, SignInWrongCredentialsError]: data = {"password": password, "email": email} response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signin"), data + NormalisedURLPath(f"{tenant_id}/recipe/signin"), + data, + user_context=user_context, ) if "status" in response and response["status"] == "OK": return SignInOkResult( @@ -164,7 +170,9 @@

    Module supertokens_python.recipe.emailpassword.recipe_im ) -> Union[SignUpOkResult, SignUpEmailAlreadyExistsError]: data = {"password": password, "email": email} response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signup"), data + NormalisedURLPath(f"{tenant_id}/recipe/signup"), + data, + user_context=user_context, ) if "status" in response and response["status"] == "OK": return SignUpOkResult( @@ -209,7 +217,9 @@

    Module supertokens_python.recipe.emailpassword.recipe_im return UpdateEmailOrPasswordPasswordPolicyViolationError(error) data = {"password": password, **data} response = await self.querier.send_put_request( - NormalisedURLPath("/recipe/user"), data + NormalisedURLPath("/recipe/user"), + data, + user_context=user_context, ) if "status" in response and response["status"] == "OK": return UpdateEmailOrPasswordOkResult() @@ -253,7 +263,7 @@

    Classes

    ) -> Union[User, None]: params = {"userId": user_id} response = await self.querier.send_get_request( - NormalisedURLPath("/recipe/user"), params + NormalisedURLPath("/recipe/user"), params, user_context ) if "status" in response and response["status"] == "OK": return User( @@ -269,7 +279,7 @@

    Classes

    ) -> Union[User, None]: params = {"email": email} response = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/user"), params + NormalisedURLPath(f"{tenant_id}/recipe/user"), params, user_context ) if "status" in response and response["status"] == "OK": return User( @@ -285,7 +295,9 @@

    Classes

    ) -> Union[CreateResetPasswordOkResult, CreateResetPasswordWrongUserIdError]: data = {"userId": user_id} response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/user/password/reset/token"), data + NormalisedURLPath(f"{tenant_id}/recipe/user/password/reset/token"), + data, + user_context=user_context, ) if "status" in response and response["status"] == "OK": return CreateResetPasswordOkResult(response["token"]) @@ -302,7 +314,9 @@

    Classes

    ]: data = {"method": "token", "token": token, "newPassword": new_password} response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/user/password/reset"), data + NormalisedURLPath(f"{tenant_id}/recipe/user/password/reset"), + data, + user_context=user_context, ) if "status" not in response or response["status"] != "OK": return ResetPasswordUsingTokenInvalidTokenError() @@ -316,7 +330,9 @@

    Classes

    ) -> Union[SignInOkResult, SignInWrongCredentialsError]: data = {"password": password, "email": email} response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signin"), data + NormalisedURLPath(f"{tenant_id}/recipe/signin"), + data, + user_context=user_context, ) if "status" in response and response["status"] == "OK": return SignInOkResult( @@ -334,7 +350,9 @@

    Classes

    ) -> Union[SignUpOkResult, SignUpEmailAlreadyExistsError]: data = {"password": password, "email": email} response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signup"), data + NormalisedURLPath(f"{tenant_id}/recipe/signup"), + data, + user_context=user_context, ) if "status" in response and response["status"] == "OK": return SignUpOkResult( @@ -379,7 +397,9 @@

    Classes

    return UpdateEmailOrPasswordPasswordPolicyViolationError(error) data = {"password": password, **data} response = await self.querier.send_put_request( - NormalisedURLPath("/recipe/user"), data + NormalisedURLPath("/recipe/user"), + data, + user_context=user_context, ) if "status" in response and response["status"] == "OK": return UpdateEmailOrPasswordOkResult() @@ -408,7 +428,9 @@

    Methods

    ) -> Union[CreateResetPasswordOkResult, CreateResetPasswordWrongUserIdError]: data = {"userId": user_id} response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/user/password/reset/token"), data + NormalisedURLPath(f"{tenant_id}/recipe/user/password/reset/token"), + data, + user_context=user_context, ) if "status" in response and response["status"] == "OK": return CreateResetPasswordOkResult(response["token"]) @@ -429,7 +451,7 @@

    Methods

    ) -> Union[User, None]: params = {"email": email} response = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/user"), params + NormalisedURLPath(f"{tenant_id}/recipe/user"), params, user_context ) if "status" in response and response["status"] == "OK": return User( @@ -455,7 +477,7 @@

    Methods

    ) -> Union[User, None]: params = {"userId": user_id} response = await self.querier.send_get_request( - NormalisedURLPath("/recipe/user"), params + NormalisedURLPath("/recipe/user"), params, user_context ) if "status" in response and response["status"] == "OK": return User( @@ -487,7 +509,9 @@

    Methods

    ]: data = {"method": "token", "token": token, "newPassword": new_password} response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/user/password/reset"), data + NormalisedURLPath(f"{tenant_id}/recipe/user/password/reset"), + data, + user_context=user_context, ) if "status" not in response or response["status"] != "OK": return ResetPasswordUsingTokenInvalidTokenError() @@ -511,7 +535,9 @@

    Methods

    ) -> Union[SignInOkResult, SignInWrongCredentialsError]: data = {"password": password, "email": email} response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signin"), data + NormalisedURLPath(f"{tenant_id}/recipe/signin"), + data, + user_context=user_context, ) if "status" in response and response["status"] == "OK": return SignInOkResult( @@ -539,7 +565,9 @@

    Methods

    ) -> Union[SignUpOkResult, SignUpEmailAlreadyExistsError]: data = {"password": password, "email": email} response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signup"), data + NormalisedURLPath(f"{tenant_id}/recipe/signup"), + data, + user_context=user_context, ) if "status" in response and response["status"] == "OK": return SignUpOkResult( @@ -594,7 +622,9 @@

    Methods

    return UpdateEmailOrPasswordPasswordPolicyViolationError(error) data = {"password": password, **data} response = await self.querier.send_put_request( - NormalisedURLPath("/recipe/user"), data + NormalisedURLPath("/recipe/user"), + data, + user_context=user_context, ) if "status" in response and response["status"] == "OK": return UpdateEmailOrPasswordOkResult() diff --git a/html/supertokens_python/recipe/emailverification/recipe_implementation.html b/html/supertokens_python/recipe/emailverification/recipe_implementation.html index 4b9d0d304..b5aba3c97 100644 --- a/html/supertokens_python/recipe/emailverification/recipe_implementation.html +++ b/html/supertokens_python/recipe/emailverification/recipe_implementation.html @@ -76,7 +76,9 @@

    Module supertokens_python.recipe.emailverification.recip ]: data = {"userId": user_id, "email": email} response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/user/email/verify/token"), data + NormalisedURLPath(f"{tenant_id}/recipe/user/email/verify/token"), + data, + user_context, ) if "status" in response and response["status"] == "OK": return CreateEmailVerificationTokenOkResult(response["token"]) @@ -87,7 +89,9 @@

    Module supertokens_python.recipe.emailverification.recip ) -> Union[VerifyEmailUsingTokenOkResult, VerifyEmailUsingTokenInvalidTokenError]: data = {"method": "token", "token": token} response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/user/email/verify"), data + NormalisedURLPath(f"{tenant_id}/recipe/user/email/verify"), + data, + user_context, ) if "status" in response and response["status"] == "OK": return VerifyEmailUsingTokenOkResult( @@ -100,7 +104,7 @@

    Module supertokens_python.recipe.emailverification.recip ) -> bool: params = {"userId": user_id, "email": email} response = await self.querier.send_get_request( - NormalisedURLPath("/recipe/user/email/verify"), params + NormalisedURLPath("/recipe/user/email/verify"), params, user_context ) return response["isVerified"] @@ -111,6 +115,7 @@

    Module supertokens_python.recipe.emailverification.recip await self.querier.send_post_request( NormalisedURLPath(f"{tenant_id}/recipe/user/email/verify/token/remove"), data, + user_context, ) return RevokeEmailVerificationTokensOkResult() @@ -119,7 +124,7 @@

    Module supertokens_python.recipe.emailverification.recip ) -> UnverifyEmailOkResult: data = {"userId": user_id, "email": email} await self.querier.send_post_request( - NormalisedURLPath("/recipe/user/email/verify/remove"), data + NormalisedURLPath("/recipe/user/email/verify/remove"), data, user_context ) return UnverifyEmailOkResult() @@ -158,7 +163,9 @@

    Classes

    ]: data = {"userId": user_id, "email": email} response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/user/email/verify/token"), data + NormalisedURLPath(f"{tenant_id}/recipe/user/email/verify/token"), + data, + user_context, ) if "status" in response and response["status"] == "OK": return CreateEmailVerificationTokenOkResult(response["token"]) @@ -169,7 +176,9 @@

    Classes

    ) -> Union[VerifyEmailUsingTokenOkResult, VerifyEmailUsingTokenInvalidTokenError]: data = {"method": "token", "token": token} response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/user/email/verify"), data + NormalisedURLPath(f"{tenant_id}/recipe/user/email/verify"), + data, + user_context, ) if "status" in response and response["status"] == "OK": return VerifyEmailUsingTokenOkResult( @@ -182,7 +191,7 @@

    Classes

    ) -> bool: params = {"userId": user_id, "email": email} response = await self.querier.send_get_request( - NormalisedURLPath("/recipe/user/email/verify"), params + NormalisedURLPath("/recipe/user/email/verify"), params, user_context ) return response["isVerified"] @@ -193,6 +202,7 @@

    Classes

    await self.querier.send_post_request( NormalisedURLPath(f"{tenant_id}/recipe/user/email/verify/token/remove"), data, + user_context, ) return RevokeEmailVerificationTokensOkResult() @@ -201,7 +211,7 @@

    Classes

    ) -> UnverifyEmailOkResult: data = {"userId": user_id, "email": email} await self.querier.send_post_request( - NormalisedURLPath("/recipe/user/email/verify/remove"), data + NormalisedURLPath("/recipe/user/email/verify/remove"), data, user_context ) return UnverifyEmailOkResult()
    @@ -229,7 +239,9 @@

    Methods

    ]: data = {"userId": user_id, "email": email} response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/user/email/verify/token"), data + NormalisedURLPath(f"{tenant_id}/recipe/user/email/verify/token"), + data, + user_context, ) if "status" in response and response["status"] == "OK": return CreateEmailVerificationTokenOkResult(response["token"]) @@ -250,7 +262,7 @@

    Methods

    ) -> bool: params = {"userId": user_id, "email": email} response = await self.querier.send_get_request( - NormalisedURLPath("/recipe/user/email/verify"), params + NormalisedURLPath("/recipe/user/email/verify"), params, user_context ) return response["isVerified"]
    @@ -271,6 +283,7 @@

    Methods

    await self.querier.send_post_request( NormalisedURLPath(f"{tenant_id}/recipe/user/email/verify/token/remove"), data, + user_context, ) return RevokeEmailVerificationTokensOkResult()
    @@ -289,7 +302,7 @@

    Methods

    ) -> UnverifyEmailOkResult: data = {"userId": user_id, "email": email} await self.querier.send_post_request( - NormalisedURLPath("/recipe/user/email/verify/remove"), data + NormalisedURLPath("/recipe/user/email/verify/remove"), data, user_context ) return UnverifyEmailOkResult()
    @@ -308,7 +321,9 @@

    Methods

    ) -> Union[VerifyEmailUsingTokenOkResult, VerifyEmailUsingTokenInvalidTokenError]: data = {"method": "token", "token": token} response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/user/email/verify"), data + NormalisedURLPath(f"{tenant_id}/recipe/user/email/verify"), + data, + user_context, ) if "status" in response and response["status"] == "OK": return VerifyEmailUsingTokenOkResult( diff --git a/html/supertokens_python/recipe/jwt/recipe_implementation.html b/html/supertokens_python/recipe/jwt/recipe_implementation.html index c1750e593..813e2cc8c 100644 --- a/html/supertokens_python/recipe/jwt/recipe_implementation.html +++ b/html/supertokens_python/recipe/jwt/recipe_implementation.html @@ -90,7 +90,9 @@

    Module supertokens_python.recipe.jwt.recipe_implementati "jwksDomain": self.app_info.api_domain.get_as_string_dangerous(), } response = await self.querier.send_post_request( - NormalisedURLPath("/recipe/jwt"), data + NormalisedURLPath("/recipe/jwt"), + data, + user_context=user_context, ) if response["status"] == "OK": @@ -99,7 +101,9 @@

    Module supertokens_python.recipe.jwt.recipe_implementati async def get_jwks(self, user_context: Dict[str, Any]) -> GetJWKSResult: response = await self.querier.send_get_request( - NormalisedURLPath("/.well-known/jwks.json"), {} + NormalisedURLPath("/.well-known/jwks.json"), + {}, + user_context=user_context, ) validity_in_secs = DEFAULT_JWKS_MAX_AGE @@ -171,7 +175,9 @@

    Classes

    "jwksDomain": self.app_info.api_domain.get_as_string_dangerous(), } response = await self.querier.send_post_request( - NormalisedURLPath("/recipe/jwt"), data + NormalisedURLPath("/recipe/jwt"), + data, + user_context=user_context, ) if response["status"] == "OK": @@ -180,7 +186,9 @@

    Classes

    async def get_jwks(self, user_context: Dict[str, Any]) -> GetJWKSResult: response = await self.querier.send_get_request( - NormalisedURLPath("/.well-known/jwks.json"), {} + NormalisedURLPath("/.well-known/jwks.json"), + {}, + user_context=user_context, ) validity_in_secs = DEFAULT_JWKS_MAX_AGE @@ -240,7 +248,9 @@

    Methods

    "jwksDomain": self.app_info.api_domain.get_as_string_dangerous(), } response = await self.querier.send_post_request( - NormalisedURLPath("/recipe/jwt"), data + NormalisedURLPath("/recipe/jwt"), + data, + user_context=user_context, ) if response["status"] == "OK": @@ -259,7 +269,9 @@

    Methods

    async def get_jwks(self, user_context: Dict[str, Any]) -> GetJWKSResult:
         response = await self.querier.send_get_request(
    -        NormalisedURLPath("/.well-known/jwks.json"), {}
    +        NormalisedURLPath("/.well-known/jwks.json"),
    +        {},
    +        user_context=user_context,
         )
     
         validity_in_secs = DEFAULT_JWKS_MAX_AGE
    diff --git a/html/supertokens_python/recipe/multitenancy/recipe_implementation.html b/html/supertokens_python/recipe/multitenancy/recipe_implementation.html
    index 249fa3dba..c292ec5c7 100644
    --- a/html/supertokens_python/recipe/multitenancy/recipe_implementation.html
    +++ b/html/supertokens_python/recipe/multitenancy/recipe_implementation.html
    @@ -171,6 +171,7 @@ 

    Module supertokens_python.recipe.multitenancy.recipe_imp "tenantId": tenant_id, **(config.to_json() if config is not None else {}), }, + user_context=user_context, ) return CreateOrUpdateTenantOkResult( created_new=response["createdNew"], @@ -182,6 +183,7 @@

    Module supertokens_python.recipe.multitenancy.recipe_imp response = await self.querier.send_post_request( NormalisedURLPath("/recipe/multitenancy/tenant/remove"), {"tenantId": tenant_id}, + user_context=user_context, ) return DeleteTenantOkResult( did_exist=response["didExist"], @@ -194,6 +196,8 @@

    Module supertokens_python.recipe.multitenancy.recipe_imp NormalisedURLPath( f"{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant" ), + None, + user_context=user_context, ) if res["status"] == "TENANT_NOT_FOUND_ERROR": @@ -214,6 +218,7 @@

    Module supertokens_python.recipe.multitenancy.recipe_imp response = await self.querier.send_get_request( NormalisedURLPath("/recipe/multitenancy/tenant/list"), {}, + user_context=user_context, ) tenant_items: List[ListAllTenantsItem] = [] @@ -248,6 +253,7 @@

    Module supertokens_python.recipe.multitenancy.recipe_imp "config": config.to_json(), "skipValidation": skip_validation is True, }, + user_context=user_context, ) return CreateOrUpdateThirdPartyConfigOkResult( @@ -267,6 +273,7 @@

    Module supertokens_python.recipe.multitenancy.recipe_imp { "thirdPartyId": third_party_id, }, + user_context=user_context, ) return DeleteThirdPartyConfigOkResult( @@ -289,6 +296,7 @@

    Module supertokens_python.recipe.multitenancy.recipe_imp { "userId": user_id, }, + user_context=user_context, ) if response["status"] == "OK": @@ -322,6 +330,7 @@

    Module supertokens_python.recipe.multitenancy.recipe_imp { "userId": user_id, }, + user_context=user_context, ) return DisassociateUserFromTenantOkResult( @@ -456,6 +465,7 @@

    Classes

    "tenantId": tenant_id, **(config.to_json() if config is not None else {}), }, + user_context=user_context, ) return CreateOrUpdateTenantOkResult( created_new=response["createdNew"], @@ -467,6 +477,7 @@

    Classes

    response = await self.querier.send_post_request( NormalisedURLPath("/recipe/multitenancy/tenant/remove"), {"tenantId": tenant_id}, + user_context=user_context, ) return DeleteTenantOkResult( did_exist=response["didExist"], @@ -479,6 +490,8 @@

    Classes

    NormalisedURLPath( f"{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant" ), + None, + user_context=user_context, ) if res["status"] == "TENANT_NOT_FOUND_ERROR": @@ -499,6 +512,7 @@

    Classes

    response = await self.querier.send_get_request( NormalisedURLPath("/recipe/multitenancy/tenant/list"), {}, + user_context=user_context, ) tenant_items: List[ListAllTenantsItem] = [] @@ -533,6 +547,7 @@

    Classes

    "config": config.to_json(), "skipValidation": skip_validation is True, }, + user_context=user_context, ) return CreateOrUpdateThirdPartyConfigOkResult( @@ -552,6 +567,7 @@

    Classes

    { "thirdPartyId": third_party_id, }, + user_context=user_context, ) return DeleteThirdPartyConfigOkResult( @@ -574,6 +590,7 @@

    Classes

    { "userId": user_id, }, + user_context=user_context, ) if response["status"] == "OK": @@ -607,6 +624,7 @@

    Classes

    { "userId": user_id, }, + user_context=user_context, ) return DisassociateUserFromTenantOkResult( @@ -645,6 +663,7 @@

    Methods

    { "userId": user_id, }, + user_context=user_context, ) if response["status"] == "OK": @@ -690,6 +709,7 @@

    Methods

    "tenantId": tenant_id, **(config.to_json() if config is not None else {}), }, + user_context=user_context, ) return CreateOrUpdateTenantOkResult( created_new=response["createdNew"], @@ -720,6 +740,7 @@

    Methods

    "config": config.to_json(), "skipValidation": skip_validation is True, }, + user_context=user_context, ) return CreateOrUpdateThirdPartyConfigOkResult( @@ -742,6 +763,7 @@

    Methods

    response = await self.querier.send_post_request( NormalisedURLPath("/recipe/multitenancy/tenant/remove"), {"tenantId": tenant_id}, + user_context=user_context, ) return DeleteTenantOkResult( did_exist=response["didExist"], @@ -770,6 +792,7 @@

    Methods

    { "thirdPartyId": third_party_id, }, + user_context=user_context, ) return DeleteThirdPartyConfigOkResult( @@ -796,6 +819,7 @@

    Methods

    { "userId": user_id, }, + user_context=user_context, ) return DisassociateUserFromTenantOkResult( @@ -819,6 +843,8 @@

    Methods

    NormalisedURLPath( f"{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant" ), + None, + user_context=user_context, ) if res["status"] == "TENANT_NOT_FOUND_ERROR": @@ -864,6 +890,7 @@

    Methods

    response = await self.querier.send_get_request( NormalisedURLPath("/recipe/multitenancy/tenant/list"), {}, + user_context=user_context, ) tenant_items: List[ListAllTenantsItem] = [] diff --git a/html/supertokens_python/recipe/passwordless/recipe_implementation.html b/html/supertokens_python/recipe/passwordless/recipe_implementation.html index a615116cb..3973b1c13 100644 --- a/html/supertokens_python/recipe/passwordless/recipe_implementation.html +++ b/html/supertokens_python/recipe/passwordless/recipe_implementation.html @@ -91,7 +91,9 @@

    Module supertokens_python.recipe.passwordless.recipe_imp if phone_number is not None: data = {**data, "phoneNumber": phone_number} result = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/code"), data + NormalisedURLPath(f"{tenant_id}/recipe/signinup/code"), + data, + user_context=user_context, ) return CreateCodeOkResult( pre_auth_session_id=result["preAuthSessionId"], @@ -118,7 +120,9 @@

    Module supertokens_python.recipe.passwordless.recipe_imp if user_input_code is not None: data = {**data, "userInputCode": user_input_code} result = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/code"), data + NormalisedURLPath(f"{tenant_id}/recipe/signinup/code"), + data, + user_context=user_context, ) if result["status"] == "RESTART_FLOW_ERROR": return CreateNewCodeForDeviceRestartFlowError() @@ -154,7 +158,9 @@

    Module supertokens_python.recipe.passwordless.recipe_imp else: data = {**data, "linkCode": link_code} result = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/code/consume"), data + NormalisedURLPath(f"{tenant_id}/recipe/signinup/code/consume"), + data, + user_context=user_context, ) if result["status"] == "OK": email = None @@ -188,7 +194,9 @@

    Module supertokens_python.recipe.passwordless.recipe_imp ) -> Union[User, None]: param = {"userId": user_id} result = await self.querier.send_get_request( - NormalisedURLPath("/recipe/user"), param + NormalisedURLPath("/recipe/user"), + param, + user_context=user_context, ) if result["status"] == "OK": email = None @@ -211,7 +219,9 @@

    Module supertokens_python.recipe.passwordless.recipe_imp ) -> Union[User, None]: param = {"email": email} result = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/user"), param + NormalisedURLPath(f"{tenant_id}/recipe/user"), + param, + user_context=user_context, ) if result["status"] == "OK": email_resp = None @@ -234,7 +244,9 @@

    Module supertokens_python.recipe.passwordless.recipe_imp ) -> Union[User, None]: param = {"phoneNumber": phone_number} result = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/user"), param + NormalisedURLPath(f"{tenant_id}/recipe/user"), + param, + user_context=user_context, ) if result["status"] == "OK": email_resp = None @@ -270,7 +282,9 @@

    Module supertokens_python.recipe.passwordless.recipe_imp if phone_number is not None: data = {**data, "phoneNumber": phone_number} result = await self.querier.send_put_request( - NormalisedURLPath("/recipe/user"), data + NormalisedURLPath("/recipe/user"), + data, + user_context=user_context, ) if result["status"] == "OK": return UpdateUserOkResult() @@ -285,7 +299,9 @@

    Module supertokens_python.recipe.passwordless.recipe_imp ) -> Union[DeleteUserInfoOkResult, DeleteUserInfoUnknownUserIdError]: data = {"userId": user_id, "email": None} result = await self.querier.send_put_request( - NormalisedURLPath("/recipe/user"), data + NormalisedURLPath("/recipe/user"), + data, + user_context=user_context, ) if result["status"] == "OK": return DeleteUserInfoOkResult() @@ -300,7 +316,9 @@

    Module supertokens_python.recipe.passwordless.recipe_imp ) -> Union[DeleteUserInfoOkResult, DeleteUserInfoUnknownUserIdError]: data = {"userId": user_id, "phoneNumber": None} result = await self.querier.send_put_request( - NormalisedURLPath("/recipe/user"), data + NormalisedURLPath("/recipe/user"), + data, + user_context=user_context, ) if result["status"] == "OK": return DeleteUserInfoOkResult() @@ -323,7 +341,9 @@

    Module supertokens_python.recipe.passwordless.recipe_imp if phone_number is not None: data = {**data, "email": phone_number} await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes/remove"), data + NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes/remove"), + data, + user_context=user_context, ) return RevokeAllCodesOkResult() @@ -332,7 +352,9 @@

    Module supertokens_python.recipe.passwordless.recipe_imp ) -> RevokeCodeOkResult: data = {"codeId": code_id} await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/code/remove"), data + NormalisedURLPath(f"{tenant_id}/recipe/signinup/code/remove"), + data, + user_context=user_context, ) return RevokeCodeOkResult() @@ -341,7 +363,9 @@

    Module supertokens_python.recipe.passwordless.recipe_imp ) -> List[DeviceType]: param = {"email": email} result = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), param + NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), + param, + user_context=user_context, ) devices: List[DeviceType] = [] if "devices" in result: @@ -380,7 +404,9 @@

    Module supertokens_python.recipe.passwordless.recipe_imp ) -> List[DeviceType]: param = {"phoneNumber": phone_number} result = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), param + NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), + param, + user_context=user_context, ) devices: List[DeviceType] = [] if "devices" in result: @@ -419,7 +445,9 @@

    Module supertokens_python.recipe.passwordless.recipe_imp ) -> Union[DeviceType, None]: param = {"deviceId": device_id} result = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), param + NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), + param, + user_context=user_context, ) if "devices" in result and len(result["devices"]) == 1: codes: List[DeviceCode] = [] @@ -454,7 +482,9 @@

    Module supertokens_python.recipe.passwordless.recipe_imp ) -> Union[DeviceType, None]: param = {"preAuthSessionId": pre_auth_session_id} result = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), param + NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), + param, + user_context=user_context, ) if "devices" in result and len(result["devices"]) == 1: codes: List[DeviceCode] = [] @@ -526,7 +556,9 @@

    Classes

    if phone_number is not None: data = {**data, "phoneNumber": phone_number} result = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/code"), data + NormalisedURLPath(f"{tenant_id}/recipe/signinup/code"), + data, + user_context=user_context, ) return CreateCodeOkResult( pre_auth_session_id=result["preAuthSessionId"], @@ -553,7 +585,9 @@

    Classes

    if user_input_code is not None: data = {**data, "userInputCode": user_input_code} result = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/code"), data + NormalisedURLPath(f"{tenant_id}/recipe/signinup/code"), + data, + user_context=user_context, ) if result["status"] == "RESTART_FLOW_ERROR": return CreateNewCodeForDeviceRestartFlowError() @@ -589,7 +623,9 @@

    Classes

    else: data = {**data, "linkCode": link_code} result = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/code/consume"), data + NormalisedURLPath(f"{tenant_id}/recipe/signinup/code/consume"), + data, + user_context=user_context, ) if result["status"] == "OK": email = None @@ -623,7 +659,9 @@

    Classes

    ) -> Union[User, None]: param = {"userId": user_id} result = await self.querier.send_get_request( - NormalisedURLPath("/recipe/user"), param + NormalisedURLPath("/recipe/user"), + param, + user_context=user_context, ) if result["status"] == "OK": email = None @@ -646,7 +684,9 @@

    Classes

    ) -> Union[User, None]: param = {"email": email} result = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/user"), param + NormalisedURLPath(f"{tenant_id}/recipe/user"), + param, + user_context=user_context, ) if result["status"] == "OK": email_resp = None @@ -669,7 +709,9 @@

    Classes

    ) -> Union[User, None]: param = {"phoneNumber": phone_number} result = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/user"), param + NormalisedURLPath(f"{tenant_id}/recipe/user"), + param, + user_context=user_context, ) if result["status"] == "OK": email_resp = None @@ -705,7 +747,9 @@

    Classes

    if phone_number is not None: data = {**data, "phoneNumber": phone_number} result = await self.querier.send_put_request( - NormalisedURLPath("/recipe/user"), data + NormalisedURLPath("/recipe/user"), + data, + user_context=user_context, ) if result["status"] == "OK": return UpdateUserOkResult() @@ -720,7 +764,9 @@

    Classes

    ) -> Union[DeleteUserInfoOkResult, DeleteUserInfoUnknownUserIdError]: data = {"userId": user_id, "email": None} result = await self.querier.send_put_request( - NormalisedURLPath("/recipe/user"), data + NormalisedURLPath("/recipe/user"), + data, + user_context=user_context, ) if result["status"] == "OK": return DeleteUserInfoOkResult() @@ -735,7 +781,9 @@

    Classes

    ) -> Union[DeleteUserInfoOkResult, DeleteUserInfoUnknownUserIdError]: data = {"userId": user_id, "phoneNumber": None} result = await self.querier.send_put_request( - NormalisedURLPath("/recipe/user"), data + NormalisedURLPath("/recipe/user"), + data, + user_context=user_context, ) if result["status"] == "OK": return DeleteUserInfoOkResult() @@ -758,7 +806,9 @@

    Classes

    if phone_number is not None: data = {**data, "email": phone_number} await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes/remove"), data + NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes/remove"), + data, + user_context=user_context, ) return RevokeAllCodesOkResult() @@ -767,7 +817,9 @@

    Classes

    ) -> RevokeCodeOkResult: data = {"codeId": code_id} await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/code/remove"), data + NormalisedURLPath(f"{tenant_id}/recipe/signinup/code/remove"), + data, + user_context=user_context, ) return RevokeCodeOkResult() @@ -776,7 +828,9 @@

    Classes

    ) -> List[DeviceType]: param = {"email": email} result = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), param + NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), + param, + user_context=user_context, ) devices: List[DeviceType] = [] if "devices" in result: @@ -815,7 +869,9 @@

    Classes

    ) -> List[DeviceType]: param = {"phoneNumber": phone_number} result = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), param + NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), + param, + user_context=user_context, ) devices: List[DeviceType] = [] if "devices" in result: @@ -854,7 +910,9 @@

    Classes

    ) -> Union[DeviceType, None]: param = {"deviceId": device_id} result = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), param + NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), + param, + user_context=user_context, ) if "devices" in result and len(result["devices"]) == 1: codes: List[DeviceCode] = [] @@ -889,7 +947,9 @@

    Classes

    ) -> Union[DeviceType, None]: param = {"preAuthSessionId": pre_auth_session_id} result = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), param + NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), + param, + user_context=user_context, ) if "devices" in result and len(result["devices"]) == 1: codes: List[DeviceCode] = [] @@ -955,7 +1015,9 @@

    Methods

    else: data = {**data, "linkCode": link_code} result = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/code/consume"), data + NormalisedURLPath(f"{tenant_id}/recipe/signinup/code/consume"), + data, + user_context=user_context, ) if result["status"] == "OK": email = None @@ -1010,7 +1072,9 @@

    Methods

    if phone_number is not None: data = {**data, "phoneNumber": phone_number} result = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/code"), data + NormalisedURLPath(f"{tenant_id}/recipe/signinup/code"), + data, + user_context=user_context, ) return CreateCodeOkResult( pre_auth_session_id=result["preAuthSessionId"], @@ -1047,7 +1111,9 @@

    Methods

    if user_input_code is not None: data = {**data, "userInputCode": user_input_code} result = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/code"), data + NormalisedURLPath(f"{tenant_id}/recipe/signinup/code"), + data, + user_context=user_context, ) if result["status"] == "RESTART_FLOW_ERROR": return CreateNewCodeForDeviceRestartFlowError() @@ -1078,7 +1144,9 @@

    Methods

    ) -> Union[DeleteUserInfoOkResult, DeleteUserInfoUnknownUserIdError]: data = {"userId": user_id, "email": None} result = await self.querier.send_put_request( - NormalisedURLPath("/recipe/user"), data + NormalisedURLPath("/recipe/user"), + data, + user_context=user_context, ) if result["status"] == "OK": return DeleteUserInfoOkResult() @@ -1103,7 +1171,9 @@

    Methods

    ) -> Union[DeleteUserInfoOkResult, DeleteUserInfoUnknownUserIdError]: data = {"userId": user_id, "phoneNumber": None} result = await self.querier.send_put_request( - NormalisedURLPath("/recipe/user"), data + NormalisedURLPath("/recipe/user"), + data, + user_context=user_context, ) if result["status"] == "OK": return DeleteUserInfoOkResult() @@ -1128,7 +1198,9 @@

    Methods

    ) -> Union[User, None]: param = {"email": email} result = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/user"), param + NormalisedURLPath(f"{tenant_id}/recipe/user"), + param, + user_context=user_context, ) if result["status"] == "OK": email_resp = None @@ -1161,7 +1233,9 @@

    Methods

    ) -> Union[User, None]: param = {"userId": user_id} result = await self.querier.send_get_request( - NormalisedURLPath("/recipe/user"), param + NormalisedURLPath("/recipe/user"), + param, + user_context=user_context, ) if result["status"] == "OK": email = None @@ -1194,7 +1268,9 @@

    Methods

    ) -> Union[User, None]: param = {"phoneNumber": phone_number} result = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/user"), param + NormalisedURLPath(f"{tenant_id}/recipe/user"), + param, + user_context=user_context, ) if result["status"] == "OK": email_resp = None @@ -1227,7 +1303,9 @@

    Methods

    ) -> Union[DeviceType, None]: param = {"deviceId": device_id} result = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), param + NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), + param, + user_context=user_context, ) if "devices" in result and len(result["devices"]) == 1: codes: List[DeviceCode] = [] @@ -1272,7 +1350,9 @@

    Methods

    ) -> List[DeviceType]: param = {"email": email} result = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), param + NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), + param, + user_context=user_context, ) devices: List[DeviceType] = [] if "devices" in result: @@ -1321,7 +1401,9 @@

    Methods

    ) -> List[DeviceType]: param = {"phoneNumber": phone_number} result = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), param + NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), + param, + user_context=user_context, ) devices: List[DeviceType] = [] if "devices" in result: @@ -1370,7 +1452,9 @@

    Methods

    ) -> Union[DeviceType, None]: param = {"preAuthSessionId": pre_auth_session_id} result = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), param + NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes"), + param, + user_context=user_context, ) if "devices" in result and len(result["devices"]) == 1: codes: List[DeviceCode] = [] @@ -1423,7 +1507,9 @@

    Methods

    if phone_number is not None: data = {**data, "email": phone_number} await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes/remove"), data + NormalisedURLPath(f"{tenant_id}/recipe/signinup/codes/remove"), + data, + user_context=user_context, ) return RevokeAllCodesOkResult()

    @@ -1442,7 +1528,9 @@

    Methods

    ) -> RevokeCodeOkResult: data = {"codeId": code_id} await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup/code/remove"), data + NormalisedURLPath(f"{tenant_id}/recipe/signinup/code/remove"), + data, + user_context=user_context, ) return RevokeCodeOkResult()
    @@ -1474,7 +1562,9 @@

    Methods

    if phone_number is not None: data = {**data, "phoneNumber": phone_number} result = await self.querier.send_put_request( - NormalisedURLPath("/recipe/user"), data + NormalisedURLPath("/recipe/user"), + data, + user_context=user_context, ) if result["status"] == "OK": return UpdateUserOkResult() diff --git a/html/supertokens_python/recipe/session/recipe_implementation.html b/html/supertokens_python/recipe/session/recipe_implementation.html index bcf7133e9..0f71edd01 100644 --- a/html/supertokens_python/recipe/session/recipe_implementation.html +++ b/html/supertokens_python/recipe/session/recipe_implementation.html @@ -105,6 +105,7 @@

    Module supertokens_python.recipe.session.recipe_implemen disable_anti_csrf is True, access_token_payload, session_data_in_database, + user_context=user_context, ) log_debug_message("createNewSession: Finished") @@ -259,6 +260,7 @@

    Module supertokens_python.recipe.session.recipe_implemen anti_csrf_token, (anti_csrf_check is not False), (check_database is True), + user_context, ) log_debug_message("getSession: Success!") @@ -321,6 +323,7 @@

    Module supertokens_python.recipe.session.recipe_implemen refresh_token, anti_csrf_token, disable_anti_csrf, + user_context=user_context, ) log_debug_message("refreshSession: Success!") @@ -353,7 +356,9 @@

    Module supertokens_python.recipe.session.recipe_implemen async def revoke_session( self, session_handle: str, user_context: Dict[str, Any] ) -> bool: - return await session_functions.revoke_session(self, session_handle) + return await session_functions.revoke_session( + self, session_handle, user_context + ) async def revoke_all_sessions_for_user( self, @@ -363,7 +368,7 @@

    Module supertokens_python.recipe.session.recipe_implemen user_context: Dict[str, Any], ) -> List[str]: return await session_functions.revoke_all_sessions_for_user( - self, user_id, tenant_id, revoke_across_all_tenants + self, user_id, tenant_id, revoke_across_all_tenants, user_context ) async def get_all_session_handles_for_user( @@ -374,18 +379,22 @@

    Module supertokens_python.recipe.session.recipe_implemen user_context: Dict[str, Any], ) -> List[str]: return await session_functions.get_all_session_handles_for_user( - self, user_id, tenant_id, fetch_across_all_tenants + self, user_id, tenant_id, fetch_across_all_tenants, user_context ) async def revoke_multiple_sessions( self, session_handles: List[str], user_context: Dict[str, Any] ) -> List[str]: - return await session_functions.revoke_multiple_sessions(self, session_handles) + return await session_functions.revoke_multiple_sessions( + self, session_handles, user_context + ) async def get_session_information( self, session_handle: str, user_context: Dict[str, Any] ) -> Union[SessionInformationResult, None]: - return await session_functions.get_session_information(self, session_handle) + return await session_functions.get_session_information( + self, session_handle, user_context + ) async def update_session_data_in_database( self, @@ -394,7 +403,7 @@

    Module supertokens_python.recipe.session.recipe_implemen user_context: Dict[str, Any], ) -> bool: return await session_functions.update_session_data_in_database( - self, session_handle, new_session_data + self, session_handle, new_session_data, user_context ) async def merge_into_access_token_payload( @@ -421,7 +430,7 @@

    Module supertokens_python.recipe.session.recipe_implemen del new_access_token_payload[k] return await session_functions.update_access_token_payload( - self, session_handle, new_access_token_payload + self, session_handle, new_access_token_payload, user_context ) async def fetch_and_set_claim( @@ -500,6 +509,7 @@

    Module supertokens_python.recipe.session.recipe_implemen response = await self.querier.send_post_request( NormalisedURLPath("/recipe/session/regenerate"), {"accessToken": access_token, "userDataInJWT": new_access_token_payload}, + user_context=user_context, ) if response["status"] == "UNAUTHORISED": return None @@ -564,6 +574,7 @@

    Classes

    disable_anti_csrf is True, access_token_payload, session_data_in_database, + user_context=user_context, ) log_debug_message("createNewSession: Finished") @@ -718,6 +729,7 @@

    Classes

    anti_csrf_token, (anti_csrf_check is not False), (check_database is True), + user_context, ) log_debug_message("getSession: Success!") @@ -780,6 +792,7 @@

    Classes

    refresh_token, anti_csrf_token, disable_anti_csrf, + user_context=user_context, ) log_debug_message("refreshSession: Success!") @@ -812,7 +825,9 @@

    Classes

    async def revoke_session( self, session_handle: str, user_context: Dict[str, Any] ) -> bool: - return await session_functions.revoke_session(self, session_handle) + return await session_functions.revoke_session( + self, session_handle, user_context + ) async def revoke_all_sessions_for_user( self, @@ -822,7 +837,7 @@

    Classes

    user_context: Dict[str, Any], ) -> List[str]: return await session_functions.revoke_all_sessions_for_user( - self, user_id, tenant_id, revoke_across_all_tenants + self, user_id, tenant_id, revoke_across_all_tenants, user_context ) async def get_all_session_handles_for_user( @@ -833,18 +848,22 @@

    Classes

    user_context: Dict[str, Any], ) -> List[str]: return await session_functions.get_all_session_handles_for_user( - self, user_id, tenant_id, fetch_across_all_tenants + self, user_id, tenant_id, fetch_across_all_tenants, user_context ) async def revoke_multiple_sessions( self, session_handles: List[str], user_context: Dict[str, Any] ) -> List[str]: - return await session_functions.revoke_multiple_sessions(self, session_handles) + return await session_functions.revoke_multiple_sessions( + self, session_handles, user_context + ) async def get_session_information( self, session_handle: str, user_context: Dict[str, Any] ) -> Union[SessionInformationResult, None]: - return await session_functions.get_session_information(self, session_handle) + return await session_functions.get_session_information( + self, session_handle, user_context + ) async def update_session_data_in_database( self, @@ -853,7 +872,7 @@

    Classes

    user_context: Dict[str, Any], ) -> bool: return await session_functions.update_session_data_in_database( - self, session_handle, new_session_data + self, session_handle, new_session_data, user_context ) async def merge_into_access_token_payload( @@ -880,7 +899,7 @@

    Classes

    del new_access_token_payload[k] return await session_functions.update_access_token_payload( - self, session_handle, new_access_token_payload + self, session_handle, new_access_token_payload, user_context ) async def fetch_and_set_claim( @@ -959,6 +978,7 @@

    Classes

    response = await self.querier.send_post_request( NormalisedURLPath("/recipe/session/regenerate"), {"accessToken": access_token, "userDataInJWT": new_access_token_payload}, + user_context=user_context, ) if response["status"] == "UNAUTHORISED": return None @@ -1011,6 +1031,7 @@

    Methods

    disable_anti_csrf is True, access_token_payload, session_data_in_database, + user_context=user_context, ) log_debug_message("createNewSession: Finished") @@ -1082,7 +1103,7 @@

    Methods

    user_context: Dict[str, Any], ) -> List[str]: return await session_functions.get_all_session_handles_for_user( - self, user_id, tenant_id, fetch_across_all_tenants + self, user_id, tenant_id, fetch_across_all_tenants, user_context )
    @@ -1206,6 +1227,7 @@

    Methods

    anti_csrf_token, (anti_csrf_check is not False), (check_database is True), + user_context, ) log_debug_message("getSession: Success!") @@ -1259,7 +1281,9 @@

    Methods

    async def get_session_information(
         self, session_handle: str, user_context: Dict[str, Any]
     ) -> Union[SessionInformationResult, None]:
    -    return await session_functions.get_session_information(self, session_handle)
    + return await session_functions.get_session_information( + self, session_handle, user_context + )
    @@ -1295,7 +1319,7 @@

    Methods

    del new_access_token_payload[k] return await session_functions.update_access_token_payload( - self, session_handle, new_access_token_payload + self, session_handle, new_access_token_payload, user_context )
    @@ -1330,6 +1354,7 @@

    Methods

    refresh_token, anti_csrf_token, disable_anti_csrf, + user_context=user_context, ) log_debug_message("refreshSession: Success!") @@ -1380,6 +1405,7 @@

    Methods

    response = await self.querier.send_post_request( NormalisedURLPath("/recipe/session/regenerate"), {"accessToken": access_token, "userDataInJWT": new_access_token_payload}, + user_context=user_context, ) if response["status"] == "UNAUTHORISED": return None @@ -1437,7 +1463,7 @@

    Methods

    user_context: Dict[str, Any], ) -> List[str]: return await session_functions.revoke_all_sessions_for_user( - self, user_id, tenant_id, revoke_across_all_tenants + self, user_id, tenant_id, revoke_across_all_tenants, user_context )
    @@ -1453,7 +1479,9 @@

    Methods

    async def revoke_multiple_sessions(
         self, session_handles: List[str], user_context: Dict[str, Any]
     ) -> List[str]:
    -    return await session_functions.revoke_multiple_sessions(self, session_handles)
    + return await session_functions.revoke_multiple_sessions( + self, session_handles, user_context + )
    @@ -1468,7 +1496,9 @@

    Methods

    async def revoke_session(
         self, session_handle: str, user_context: Dict[str, Any]
     ) -> bool:
    -    return await session_functions.revoke_session(self, session_handle)
    + return await session_functions.revoke_session( + self, session_handle, user_context + )
    @@ -1509,7 +1539,7 @@

    Methods

    user_context: Dict[str, Any], ) -> bool: return await session_functions.update_session_data_in_database( - self, session_handle, new_session_data + self, session_handle, new_session_data, user_context )
    diff --git a/html/supertokens_python/recipe/session/session_functions.html b/html/supertokens_python/recipe/session/session_functions.html index a386581df..ba9c9aa0e 100644 --- a/html/supertokens_python/recipe/session/session_functions.html +++ b/html/supertokens_python/recipe/session/session_functions.html @@ -130,6 +130,7 @@

    Module supertokens_python.recipe.session.session_functio disable_anti_csrf: bool, access_token_payload: Union[None, Dict[str, Any]], session_data_in_database: Union[None, Dict[str, Any]], + user_context: Optional[Dict[str, Any]], ) -> CreateOrRefreshAPIResponse: if session_data_in_database is None: session_data_in_database = {} @@ -148,6 +149,7 @@

    Module supertokens_python.recipe.session.session_functio "useDynamicSigningKey": recipe_implementation.config.use_dynamic_access_token_signing_key, "enableAntiCsrf": enable_anti_csrf, }, + user_context=user_context, ) return CreateOrRefreshAPIResponse( @@ -177,6 +179,7 @@

    Module supertokens_python.recipe.session.session_functio anti_csrf_token: Union[str, None], do_anti_csrf_check: bool, always_check_core: bool, + user_context: Optional[Dict[str, Any]], ) -> GetSessionAPIResponse: config = recipe_implementation.config access_token_info: Optional[Dict[str, Any]] = None @@ -304,7 +307,9 @@

    Module supertokens_python.recipe.session.session_functio data["antiCsrfToken"] = anti_csrf_token response = await recipe_implementation.querier.send_post_request( - NormalisedURLPath("/recipe/session/verify"), data + NormalisedURLPath("/recipe/session/verify"), + data, + user_context=user_context, ) if response["status"] == "OK": return GetSessionAPIResponse( @@ -350,6 +355,7 @@

    Module supertokens_python.recipe.session.session_functio refresh_token: str, anti_csrf_token: Union[str, None], disable_anti_csrf: bool, + user_context: Optional[Dict[str, Any]], ) -> CreateOrRefreshAPIResponse: data = { "refreshToken": refresh_token, @@ -373,7 +379,9 @@

    Module supertokens_python.recipe.session.session_functio ) response = await recipe_implementation.querier.send_post_request( - NormalisedURLPath("/recipe/session/refresh"), data + NormalisedURLPath("/recipe/session/refresh"), + data, + user_context=user_context, ) if response["status"] == "OK": return CreateOrRefreshAPIResponse( @@ -413,6 +421,7 @@

    Module supertokens_python.recipe.session.session_functio user_id: str, tenant_id: Optional[str], revoke_across_all_tenants: bool, + user_context: Optional[Dict[str, Any]], ) -> List[str]: if tenant_id is None: tenant_id = DEFAULT_TENANT_ID @@ -420,6 +429,7 @@

    Module supertokens_python.recipe.session.session_functio response = await recipe_implementation.querier.send_post_request( NormalisedURLPath(f"{tenant_id}/recipe/session/remove"), {"userId": user_id, "revokeAcrossAllTenants": revoke_across_all_tenants}, + user_context=user_context, ) return response["sessionHandlesRevoked"] @@ -429,6 +439,7 @@

    Module supertokens_python.recipe.session.session_functio user_id: str, tenant_id: Optional[str], fetch_across_all_tenants: bool, + user_context: Optional[Dict[str, Any]], ) -> List[str]: if tenant_id is None: tenant_id = DEFAULT_TENANT_ID @@ -436,25 +447,33 @@

    Module supertokens_python.recipe.session.session_functio response = await recipe_implementation.querier.send_get_request( NormalisedURLPath(f"{tenant_id}/recipe/session/user"), {"userId": user_id, "fetchAcrossAllTenants": fetch_across_all_tenants}, + user_context=user_context, ) return response["sessionHandles"] async def revoke_session( - recipe_implementation: RecipeImplementation, session_handle: str + recipe_implementation: RecipeImplementation, + session_handle: str, + user_context: Optional[Dict[str, Any]], ) -> bool: response = await recipe_implementation.querier.send_post_request( NormalisedURLPath("/recipe/session/remove"), {"sessionHandles": [session_handle]}, + user_context=user_context, ) return len(response["sessionHandlesRevoked"]) == 1 async def revoke_multiple_sessions( - recipe_implementation: RecipeImplementation, session_handles: List[str] + recipe_implementation: RecipeImplementation, + session_handles: List[str], + user_context: Optional[Dict[str, Any]], ) -> List[str]: response = await recipe_implementation.querier.send_post_request( - NormalisedURLPath("/recipe/session/remove"), {"sessionHandles": session_handles} + NormalisedURLPath("/recipe/session/remove"), + {"sessionHandles": session_handles}, + user_context=user_context, ) return response["sessionHandlesRevoked"] @@ -463,10 +482,12 @@

    Module supertokens_python.recipe.session.session_functio recipe_implementation: RecipeImplementation, session_handle: str, new_session_data: Dict[str, Any], + user_context: Optional[Dict[str, Any]], ) -> bool: response = await recipe_implementation.querier.send_put_request( NormalisedURLPath("/recipe/session/data"), {"sessionHandle": session_handle, "userDataInDatabase": new_session_data}, + user_context=user_context, ) if response["status"] == "UNAUTHORISED": return False @@ -478,10 +499,12 @@

    Module supertokens_python.recipe.session.session_functio recipe_implementation: RecipeImplementation, session_handle: str, new_access_token_payload: Dict[str, Any], + user_context: Optional[Dict[str, Any]], ) -> bool: response = await recipe_implementation.querier.send_put_request( NormalisedURLPath("/recipe/jwt/data"), {"sessionHandle": session_handle, "userDataInJWT": new_access_token_payload}, + user_context=user_context, ) if response["status"] == "UNAUTHORISED": return False @@ -490,10 +513,14 @@

    Module supertokens_python.recipe.session.session_functio async def get_session_information( - recipe_implementation: RecipeImplementation, session_handle: str + recipe_implementation: RecipeImplementation, + session_handle: str, + user_context: Optional[Dict[str, Any]], ) -> Union[SessionInformationResult, None]: response = await recipe_implementation.querier.send_get_request( - NormalisedURLPath("/recipe/session"), {"sessionHandle": session_handle} + NormalisedURLPath("/recipe/session"), + {"sessionHandle": session_handle}, + user_context=user_context, ) if response["status"] == "OK": return SessionInformationResult( @@ -516,7 +543,7 @@

    Module supertokens_python.recipe.session.session_functio

    Functions

    -async def create_new_session(recipe_implementation: RecipeImplementation, tenant_id: str, user_id: str, disable_anti_csrf: bool, access_token_payload: Union[None, Dict[str, Any]], session_data_in_database: Union[None, Dict[str, Any]]) ‑> CreateOrRefreshAPIResponse +async def create_new_session(recipe_implementation: RecipeImplementation, tenant_id: str, user_id: str, disable_anti_csrf: bool, access_token_payload: Union[None, Dict[str, Any]], session_data_in_database: Union[None, Dict[str, Any]], user_context: Optional[Dict[str, Any]]) ‑> CreateOrRefreshAPIResponse
    @@ -531,6 +558,7 @@

    Functions

    disable_anti_csrf: bool, access_token_payload: Union[None, Dict[str, Any]], session_data_in_database: Union[None, Dict[str, Any]], + user_context: Optional[Dict[str, Any]], ) -> CreateOrRefreshAPIResponse: if session_data_in_database is None: session_data_in_database = {} @@ -549,6 +577,7 @@

    Functions

    "useDynamicSigningKey": recipe_implementation.config.use_dynamic_access_token_signing_key, "enableAntiCsrf": enable_anti_csrf, }, + user_context=user_context, ) return CreateOrRefreshAPIResponse( @@ -573,7 +602,7 @@

    Functions

    -async def get_all_session_handles_for_user(recipe_implementation: RecipeImplementation, user_id: str, tenant_id: Optional[str], fetch_across_all_tenants: bool) ‑> List[str] +async def get_all_session_handles_for_user(recipe_implementation: RecipeImplementation, user_id: str, tenant_id: Optional[str], fetch_across_all_tenants: bool, user_context: Optional[Dict[str, Any]]) ‑> List[str]
    @@ -586,6 +615,7 @@

    Functions

    user_id: str, tenant_id: Optional[str], fetch_across_all_tenants: bool, + user_context: Optional[Dict[str, Any]], ) -> List[str]: if tenant_id is None: tenant_id = DEFAULT_TENANT_ID @@ -593,12 +623,13 @@

    Functions

    response = await recipe_implementation.querier.send_get_request( NormalisedURLPath(f"{tenant_id}/recipe/session/user"), {"userId": user_id, "fetchAcrossAllTenants": fetch_across_all_tenants}, + user_context=user_context, ) return response["sessionHandles"]
    -async def get_session(recipe_implementation: RecipeImplementation, parsed_access_token: ParsedJWTInfo, anti_csrf_token: Union[str, None], do_anti_csrf_check: bool, always_check_core: bool) ‑> GetSessionAPIResponse +async def get_session(recipe_implementation: RecipeImplementation, parsed_access_token: ParsedJWTInfo, anti_csrf_token: Union[str, None], do_anti_csrf_check: bool, always_check_core: bool, user_context: Optional[Dict[str, Any]]) ‑> GetSessionAPIResponse
    @@ -612,6 +643,7 @@

    Functions

    anti_csrf_token: Union[str, None], do_anti_csrf_check: bool, always_check_core: bool, + user_context: Optional[Dict[str, Any]], ) -> GetSessionAPIResponse: config = recipe_implementation.config access_token_info: Optional[Dict[str, Any]] = None @@ -739,7 +771,9 @@

    Functions

    data["antiCsrfToken"] = anti_csrf_token response = await recipe_implementation.querier.send_post_request( - NormalisedURLPath("/recipe/session/verify"), data + NormalisedURLPath("/recipe/session/verify"), + data, + user_context=user_context, ) if response["status"] == "OK": return GetSessionAPIResponse( @@ -781,7 +815,7 @@

    Functions

    -async def get_session_information(recipe_implementation: RecipeImplementation, session_handle: str) ‑> Union[SessionInformationResult, None] +async def get_session_information(recipe_implementation: RecipeImplementation, session_handle: str, user_context: Optional[Dict[str, Any]]) ‑> Union[SessionInformationResult, None]
    @@ -790,10 +824,14 @@

    Functions

    Expand source code
    async def get_session_information(
    -    recipe_implementation: RecipeImplementation, session_handle: str
    +    recipe_implementation: RecipeImplementation,
    +    session_handle: str,
    +    user_context: Optional[Dict[str, Any]],
     ) -> Union[SessionInformationResult, None]:
         response = await recipe_implementation.querier.send_get_request(
    -        NormalisedURLPath("/recipe/session"), {"sessionHandle": session_handle}
    +        NormalisedURLPath("/recipe/session"),
    +        {"sessionHandle": session_handle},
    +        user_context=user_context,
         )
         if response["status"] == "OK":
             return SessionInformationResult(
    @@ -809,7 +847,7 @@ 

    Functions

    -async def refresh_session(recipe_implementation: RecipeImplementation, refresh_token: str, anti_csrf_token: Union[str, None], disable_anti_csrf: bool) ‑> CreateOrRefreshAPIResponse +async def refresh_session(recipe_implementation: RecipeImplementation, refresh_token: str, anti_csrf_token: Union[str, None], disable_anti_csrf: bool, user_context: Optional[Dict[str, Any]]) ‑> CreateOrRefreshAPIResponse
    @@ -822,6 +860,7 @@

    Functions

    refresh_token: str, anti_csrf_token: Union[str, None], disable_anti_csrf: bool, + user_context: Optional[Dict[str, Any]], ) -> CreateOrRefreshAPIResponse: data = { "refreshToken": refresh_token, @@ -845,7 +884,9 @@

    Functions

    ) response = await recipe_implementation.querier.send_post_request( - NormalisedURLPath("/recipe/session/refresh"), data + NormalisedURLPath("/recipe/session/refresh"), + data, + user_context=user_context, ) if response["status"] == "OK": return CreateOrRefreshAPIResponse( @@ -881,7 +922,7 @@

    Functions

    -async def revoke_all_sessions_for_user(recipe_implementation: RecipeImplementation, user_id: str, tenant_id: Optional[str], revoke_across_all_tenants: bool) ‑> List[str] +async def revoke_all_sessions_for_user(recipe_implementation: RecipeImplementation, user_id: str, tenant_id: Optional[str], revoke_across_all_tenants: bool, user_context: Optional[Dict[str, Any]]) ‑> List[str]
    @@ -894,6 +935,7 @@

    Functions

    user_id: str, tenant_id: Optional[str], revoke_across_all_tenants: bool, + user_context: Optional[Dict[str, Any]], ) -> List[str]: if tenant_id is None: tenant_id = DEFAULT_TENANT_ID @@ -901,12 +943,13 @@

    Functions

    response = await recipe_implementation.querier.send_post_request( NormalisedURLPath(f"{tenant_id}/recipe/session/remove"), {"userId": user_id, "revokeAcrossAllTenants": revoke_across_all_tenants}, + user_context=user_context, ) return response["sessionHandlesRevoked"]
    -async def revoke_multiple_sessions(recipe_implementation: RecipeImplementation, session_handles: List[str]) ‑> List[str] +async def revoke_multiple_sessions(recipe_implementation: RecipeImplementation, session_handles: List[str], user_context: Optional[Dict[str, Any]]) ‑> List[str]
    @@ -915,16 +958,20 @@

    Functions

    Expand source code
    async def revoke_multiple_sessions(
    -    recipe_implementation: RecipeImplementation, session_handles: List[str]
    +    recipe_implementation: RecipeImplementation,
    +    session_handles: List[str],
    +    user_context: Optional[Dict[str, Any]],
     ) -> List[str]:
         response = await recipe_implementation.querier.send_post_request(
    -        NormalisedURLPath("/recipe/session/remove"), {"sessionHandles": session_handles}
    +        NormalisedURLPath("/recipe/session/remove"),
    +        {"sessionHandles": session_handles},
    +        user_context=user_context,
         )
         return response["sessionHandlesRevoked"]
    -async def revoke_session(recipe_implementation: RecipeImplementation, session_handle: str) ‑> bool +async def revoke_session(recipe_implementation: RecipeImplementation, session_handle: str, user_context: Optional[Dict[str, Any]]) ‑> bool
    @@ -933,17 +980,20 @@

    Functions

    Expand source code
    async def revoke_session(
    -    recipe_implementation: RecipeImplementation, session_handle: str
    +    recipe_implementation: RecipeImplementation,
    +    session_handle: str,
    +    user_context: Optional[Dict[str, Any]],
     ) -> bool:
         response = await recipe_implementation.querier.send_post_request(
             NormalisedURLPath("/recipe/session/remove"),
             {"sessionHandles": [session_handle]},
    +        user_context=user_context,
         )
         return len(response["sessionHandlesRevoked"]) == 1
    -async def update_access_token_payload(recipe_implementation: RecipeImplementation, session_handle: str, new_access_token_payload: Dict[str, Any]) ‑> bool +async def update_access_token_payload(recipe_implementation: RecipeImplementation, session_handle: str, new_access_token_payload: Dict[str, Any], user_context: Optional[Dict[str, Any]]) ‑> bool
    @@ -955,10 +1005,12 @@

    Functions

    recipe_implementation: RecipeImplementation, session_handle: str, new_access_token_payload: Dict[str, Any], + user_context: Optional[Dict[str, Any]], ) -> bool: response = await recipe_implementation.querier.send_put_request( NormalisedURLPath("/recipe/jwt/data"), {"sessionHandle": session_handle, "userDataInJWT": new_access_token_payload}, + user_context=user_context, ) if response["status"] == "UNAUTHORISED": return False @@ -967,7 +1019,7 @@

    Functions

    -async def update_session_data_in_database(recipe_implementation: RecipeImplementation, session_handle: str, new_session_data: Dict[str, Any]) ‑> bool +async def update_session_data_in_database(recipe_implementation: RecipeImplementation, session_handle: str, new_session_data: Dict[str, Any], user_context: Optional[Dict[str, Any]]) ‑> bool
    @@ -979,10 +1031,12 @@

    Functions

    recipe_implementation: RecipeImplementation, session_handle: str, new_session_data: Dict[str, Any], + user_context: Optional[Dict[str, Any]], ) -> bool: response = await recipe_implementation.querier.send_put_request( NormalisedURLPath("/recipe/session/data"), {"sessionHandle": session_handle, "userDataInDatabase": new_session_data}, + user_context=user_context, ) if response["status"] == "UNAUTHORISED": return False diff --git a/html/supertokens_python/recipe/thirdparty/recipe_implementation.html b/html/supertokens_python/recipe/thirdparty/recipe_implementation.html index 85879b59e..c95e7afe5 100644 --- a/html/supertokens_python/recipe/thirdparty/recipe_implementation.html +++ b/html/supertokens_python/recipe/thirdparty/recipe_implementation.html @@ -73,7 +73,9 @@

    Module supertokens_python.recipe.thirdparty.recipe_imple ) -> Union[User, None]: params = {"userId": user_id} response = await self.querier.send_get_request( - NormalisedURLPath("/recipe/user"), params + NormalisedURLPath("/recipe/user"), + params, + user_context=user_context, ) if "status" in response and response["status"] == "OK": return User( @@ -92,7 +94,9 @@

    Module supertokens_python.recipe.thirdparty.recipe_imple self, email: str, tenant_id: str, user_context: Dict[str, Any] ) -> List[User]: response = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/users/by-email"), {"email": email} + NormalisedURLPath(f"{tenant_id}/recipe/users/by-email"), + {"email": email}, + user_context=user_context, ) users: List[User] = [] users_list: List[Dict[str, Any]] = ( @@ -124,7 +128,9 @@

    Module supertokens_python.recipe.thirdparty.recipe_imple "thirdPartyUserId": third_party_user_id, } response = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/user"), params + NormalisedURLPath(f"{tenant_id}/recipe/user"), + params, + user_context=user_context, ) if "status" in response and response["status"] == "OK": return User( @@ -155,7 +161,9 @@

    Module supertokens_python.recipe.thirdparty.recipe_imple "email": {"id": email}, } response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup"), data + NormalisedURLPath(f"{tenant_id}/recipe/signinup"), + data, + user_context=user_context, ) return SignInUpOkResult( User( @@ -187,7 +195,9 @@

    Module supertokens_python.recipe.thirdparty.recipe_imple "email": {"id": email}, } response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup"), data + NormalisedURLPath(f"{tenant_id}/recipe/signinup"), + data, + user_context=user_context, ) return ManuallyCreateOrUpdateUserOkResult( User( @@ -262,7 +272,9 @@

    Classes

    ) -> Union[User, None]: params = {"userId": user_id} response = await self.querier.send_get_request( - NormalisedURLPath("/recipe/user"), params + NormalisedURLPath("/recipe/user"), + params, + user_context=user_context, ) if "status" in response and response["status"] == "OK": return User( @@ -281,7 +293,9 @@

    Classes

    self, email: str, tenant_id: str, user_context: Dict[str, Any] ) -> List[User]: response = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/users/by-email"), {"email": email} + NormalisedURLPath(f"{tenant_id}/recipe/users/by-email"), + {"email": email}, + user_context=user_context, ) users: List[User] = [] users_list: List[Dict[str, Any]] = ( @@ -313,7 +327,9 @@

    Classes

    "thirdPartyUserId": third_party_user_id, } response = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/user"), params + NormalisedURLPath(f"{tenant_id}/recipe/user"), + params, + user_context=user_context, ) if "status" in response and response["status"] == "OK": return User( @@ -344,7 +360,9 @@

    Classes

    "email": {"id": email}, } response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup"), data + NormalisedURLPath(f"{tenant_id}/recipe/signinup"), + data, + user_context=user_context, ) return SignInUpOkResult( User( @@ -376,7 +394,9 @@

    Classes

    "email": {"id": email}, } response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup"), data + NormalisedURLPath(f"{tenant_id}/recipe/signinup"), + data, + user_context=user_context, ) return ManuallyCreateOrUpdateUserOkResult( User( @@ -477,7 +497,9 @@

    Methods

    ) -> Union[User, None]: params = {"userId": user_id} response = await self.querier.send_get_request( - NormalisedURLPath("/recipe/user"), params + NormalisedURLPath("/recipe/user"), + params, + user_context=user_context, ) if "status" in response and response["status"] == "OK": return User( @@ -514,7 +536,9 @@

    Methods

    "thirdPartyUserId": third_party_user_id, } response = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/user"), params + NormalisedURLPath(f"{tenant_id}/recipe/user"), + params, + user_context=user_context, ) if "status" in response and response["status"] == "OK": return User( @@ -543,7 +567,9 @@

    Methods

    self, email: str, tenant_id: str, user_context: Dict[str, Any] ) -> List[User]: response = await self.querier.send_get_request( - NormalisedURLPath(f"{tenant_id}/recipe/users/by-email"), {"email": email} + NormalisedURLPath(f"{tenant_id}/recipe/users/by-email"), + {"email": email}, + user_context=user_context, ) users: List[User] = [] users_list: List[Dict[str, Any]] = ( @@ -587,7 +613,9 @@

    Methods

    "email": {"id": email}, } response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup"), data + NormalisedURLPath(f"{tenant_id}/recipe/signinup"), + data, + user_context=user_context, ) return ManuallyCreateOrUpdateUserOkResult( User( @@ -629,7 +657,9 @@

    Methods

    "email": {"id": email}, } response = await self.querier.send_post_request( - NormalisedURLPath(f"{tenant_id}/recipe/signinup"), data + NormalisedURLPath(f"{tenant_id}/recipe/signinup"), + data, + user_context=user_context, ) return SignInUpOkResult( User( diff --git a/html/supertokens_python/recipe/usermetadata/recipe_implementation.html b/html/supertokens_python/recipe/usermetadata/recipe_implementation.html index d04002625..77a612637 100644 --- a/html/supertokens_python/recipe/usermetadata/recipe_implementation.html +++ b/html/supertokens_python/recipe/usermetadata/recipe_implementation.html @@ -59,7 +59,9 @@

    Module supertokens_python.recipe.usermetadata.recipe_imp ) -> MetadataResult: params = {"userId": user_id} response = await self.querier.send_get_request( - NormalisedURLPath("/recipe/user/metadata"), params + NormalisedURLPath("/recipe/user/metadata"), + params, + user_context=user_context, ) return MetadataResult(metadata=response["metadata"]) @@ -71,7 +73,9 @@

    Module supertokens_python.recipe.usermetadata.recipe_imp ) -> MetadataResult: params = {"userId": user_id, "metadataUpdate": metadata_update} response = await self.querier.send_put_request( - NormalisedURLPath("/recipe/user/metadata"), params + NormalisedURLPath("/recipe/user/metadata"), + params, + user_context=user_context, ) return MetadataResult(metadata=response["metadata"]) @@ -80,7 +84,9 @@

    Module supertokens_python.recipe.usermetadata.recipe_imp ) -> ClearUserMetadataResult: params = {"userId": user_id} await self.querier.send_post_request( - NormalisedURLPath("/recipe/user/metadata/remove"), params + NormalisedURLPath("/recipe/user/metadata/remove"), + params, + user_context=user_context, ) return ClearUserMetadataResult() @@ -115,7 +121,9 @@

    Classes

    ) -> MetadataResult: params = {"userId": user_id} response = await self.querier.send_get_request( - NormalisedURLPath("/recipe/user/metadata"), params + NormalisedURLPath("/recipe/user/metadata"), + params, + user_context=user_context, ) return MetadataResult(metadata=response["metadata"]) @@ -127,7 +135,9 @@

    Classes

    ) -> MetadataResult: params = {"userId": user_id, "metadataUpdate": metadata_update} response = await self.querier.send_put_request( - NormalisedURLPath("/recipe/user/metadata"), params + NormalisedURLPath("/recipe/user/metadata"), + params, + user_context=user_context, ) return MetadataResult(metadata=response["metadata"]) @@ -136,7 +146,9 @@

    Classes

    ) -> ClearUserMetadataResult: params = {"userId": user_id} await self.querier.send_post_request( - NormalisedURLPath("/recipe/user/metadata/remove"), params + NormalisedURLPath("/recipe/user/metadata/remove"), + params, + user_context=user_context, ) return ClearUserMetadataResult()
    @@ -161,7 +173,9 @@

    Methods

    ) -> ClearUserMetadataResult: params = {"userId": user_id} await self.querier.send_post_request( - NormalisedURLPath("/recipe/user/metadata/remove"), params + NormalisedURLPath("/recipe/user/metadata/remove"), + params, + user_context=user_context, ) return ClearUserMetadataResult()
    @@ -180,7 +194,9 @@

    Methods

    ) -> MetadataResult: params = {"userId": user_id} response = await self.querier.send_get_request( - NormalisedURLPath("/recipe/user/metadata"), params + NormalisedURLPath("/recipe/user/metadata"), + params, + user_context=user_context, ) return MetadataResult(metadata=response["metadata"])
    @@ -202,7 +218,9 @@

    Methods

    ) -> MetadataResult: params = {"userId": user_id, "metadataUpdate": metadata_update} response = await self.querier.send_put_request( - NormalisedURLPath("/recipe/user/metadata"), params + NormalisedURLPath("/recipe/user/metadata"), + params, + user_context=user_context, ) return MetadataResult(metadata=response["metadata"])
    diff --git a/html/supertokens_python/recipe/userroles/recipe_implementation.html b/html/supertokens_python/recipe/userroles/recipe_implementation.html index 63b9f6277..cdb6d6f7f 100644 --- a/html/supertokens_python/recipe/userroles/recipe_implementation.html +++ b/html/supertokens_python/recipe/userroles/recipe_implementation.html @@ -78,6 +78,7 @@

    Module supertokens_python.recipe.userroles.recipe_implem response = await self.querier.send_put_request( NormalisedURLPath(f"{tenant_id}/recipe/user/role"), params, + user_context=user_context, ) if response["status"] == "OK": return AddRoleToUserOkResult( @@ -96,6 +97,7 @@

    Module supertokens_python.recipe.userroles.recipe_implem response = await self.querier.send_post_request( NormalisedURLPath(f"{tenant_id}/recipe/user/role/remove"), params, + user_context=user_context, ) if response["status"] == "OK": return RemoveUserRoleOkResult( @@ -110,6 +112,7 @@

    Module supertokens_python.recipe.userroles.recipe_implem response = await self.querier.send_get_request( NormalisedURLPath(f"{tenant_id}/recipe/user/roles"), params, + user_context=user_context, ) return GetRolesForUserOkResult(roles=response["roles"]) @@ -120,6 +123,7 @@

    Module supertokens_python.recipe.userroles.recipe_implem response = await self.querier.send_get_request( NormalisedURLPath(f"{tenant_id}/recipe/role/users"), params, + user_context=user_context, ) if response["status"] == "OK": return GetUsersThatHaveRoleOkResult(users=response["users"]) @@ -130,7 +134,9 @@

    Module supertokens_python.recipe.userroles.recipe_implem ) -> CreateNewRoleOrAddPermissionsOkResult: params = {"role": role, "permissions": permissions} response = await self.querier.send_put_request( - NormalisedURLPath("/recipe/role"), params + NormalisedURLPath("/recipe/role"), + params, + user_context=user_context, ) return CreateNewRoleOrAddPermissionsOkResult( created_new_role=response["createdNewRole"] @@ -141,7 +147,9 @@

    Module supertokens_python.recipe.userroles.recipe_implem ) -> Union[GetPermissionsForRoleOkResult, UnknownRoleError]: params = {"role": role} response = await self.querier.send_get_request( - NormalisedURLPath("/recipe/role/permissions"), params + NormalisedURLPath("/recipe/role/permissions"), + params, + user_context=user_context, ) if response["status"] == "OK": return GetPermissionsForRoleOkResult(permissions=response["permissions"]) @@ -152,7 +160,9 @@

    Module supertokens_python.recipe.userroles.recipe_implem ) -> Union[RemovePermissionsFromRoleOkResult, UnknownRoleError]: params = {"role": role, "permissions": permissions} response = await self.querier.send_post_request( - NormalisedURLPath("/recipe/role/permissions/remove"), params + NormalisedURLPath("/recipe/role/permissions/remove"), + params, + user_context=user_context, ) if response["status"] == "OK": return RemovePermissionsFromRoleOkResult() @@ -163,7 +173,9 @@

    Module supertokens_python.recipe.userroles.recipe_implem ) -> GetRolesThatHavePermissionOkResult: params = {"permission": permission} response = await self.querier.send_get_request( - NormalisedURLPath("/recipe/permission/roles"), params + NormalisedURLPath("/recipe/permission/roles"), + params, + user_context=user_context, ) return GetRolesThatHavePermissionOkResult(roles=response["roles"]) @@ -172,14 +184,18 @@

    Module supertokens_python.recipe.userroles.recipe_implem ) -> DeleteRoleOkResult: params = {"role": role} response = await self.querier.send_post_request( - NormalisedURLPath("/recipe/role/remove"), params + NormalisedURLPath("/recipe/role/remove"), + params, + user_context=user_context, ) return DeleteRoleOkResult(did_role_exist=response["didRoleExist"]) async def get_all_roles(self, user_context: Dict[str, Any]) -> GetAllRolesOkResult: params = {} response = await self.querier.send_get_request( - NormalisedURLPath("/recipe/roles"), params + NormalisedURLPath("/recipe/roles"), + params, + user_context=user_context, ) return GetAllRolesOkResult(roles=response["roles"]) @@ -220,6 +236,7 @@

    Classes

    response = await self.querier.send_put_request( NormalisedURLPath(f"{tenant_id}/recipe/user/role"), params, + user_context=user_context, ) if response["status"] == "OK": return AddRoleToUserOkResult( @@ -238,6 +255,7 @@

    Classes

    response = await self.querier.send_post_request( NormalisedURLPath(f"{tenant_id}/recipe/user/role/remove"), params, + user_context=user_context, ) if response["status"] == "OK": return RemoveUserRoleOkResult( @@ -252,6 +270,7 @@

    Classes

    response = await self.querier.send_get_request( NormalisedURLPath(f"{tenant_id}/recipe/user/roles"), params, + user_context=user_context, ) return GetRolesForUserOkResult(roles=response["roles"]) @@ -262,6 +281,7 @@

    Classes

    response = await self.querier.send_get_request( NormalisedURLPath(f"{tenant_id}/recipe/role/users"), params, + user_context=user_context, ) if response["status"] == "OK": return GetUsersThatHaveRoleOkResult(users=response["users"]) @@ -272,7 +292,9 @@

    Classes

    ) -> CreateNewRoleOrAddPermissionsOkResult: params = {"role": role, "permissions": permissions} response = await self.querier.send_put_request( - NormalisedURLPath("/recipe/role"), params + NormalisedURLPath("/recipe/role"), + params, + user_context=user_context, ) return CreateNewRoleOrAddPermissionsOkResult( created_new_role=response["createdNewRole"] @@ -283,7 +305,9 @@

    Classes

    ) -> Union[GetPermissionsForRoleOkResult, UnknownRoleError]: params = {"role": role} response = await self.querier.send_get_request( - NormalisedURLPath("/recipe/role/permissions"), params + NormalisedURLPath("/recipe/role/permissions"), + params, + user_context=user_context, ) if response["status"] == "OK": return GetPermissionsForRoleOkResult(permissions=response["permissions"]) @@ -294,7 +318,9 @@

    Classes

    ) -> Union[RemovePermissionsFromRoleOkResult, UnknownRoleError]: params = {"role": role, "permissions": permissions} response = await self.querier.send_post_request( - NormalisedURLPath("/recipe/role/permissions/remove"), params + NormalisedURLPath("/recipe/role/permissions/remove"), + params, + user_context=user_context, ) if response["status"] == "OK": return RemovePermissionsFromRoleOkResult() @@ -305,7 +331,9 @@

    Classes

    ) -> GetRolesThatHavePermissionOkResult: params = {"permission": permission} response = await self.querier.send_get_request( - NormalisedURLPath("/recipe/permission/roles"), params + NormalisedURLPath("/recipe/permission/roles"), + params, + user_context=user_context, ) return GetRolesThatHavePermissionOkResult(roles=response["roles"]) @@ -314,14 +342,18 @@

    Classes

    ) -> DeleteRoleOkResult: params = {"role": role} response = await self.querier.send_post_request( - NormalisedURLPath("/recipe/role/remove"), params + NormalisedURLPath("/recipe/role/remove"), + params, + user_context=user_context, ) return DeleteRoleOkResult(did_role_exist=response["didRoleExist"]) async def get_all_roles(self, user_context: Dict[str, Any]) -> GetAllRolesOkResult: params = {} response = await self.querier.send_get_request( - NormalisedURLPath("/recipe/roles"), params + NormalisedURLPath("/recipe/roles"), + params, + user_context=user_context, ) return GetAllRolesOkResult(roles=response["roles"])
    @@ -352,6 +384,7 @@

    Methods

    response = await self.querier.send_put_request( NormalisedURLPath(f"{tenant_id}/recipe/user/role"), params, + user_context=user_context, ) if response["status"] == "OK": return AddRoleToUserOkResult( @@ -374,7 +407,9 @@

    Methods

    ) -> CreateNewRoleOrAddPermissionsOkResult: params = {"role": role, "permissions": permissions} response = await self.querier.send_put_request( - NormalisedURLPath("/recipe/role"), params + NormalisedURLPath("/recipe/role"), + params, + user_context=user_context, ) return CreateNewRoleOrAddPermissionsOkResult( created_new_role=response["createdNewRole"] @@ -395,7 +430,9 @@

    Methods

    ) -> DeleteRoleOkResult: params = {"role": role} response = await self.querier.send_post_request( - NormalisedURLPath("/recipe/role/remove"), params + NormalisedURLPath("/recipe/role/remove"), + params, + user_context=user_context, ) return DeleteRoleOkResult(did_role_exist=response["didRoleExist"])
    @@ -412,7 +449,9 @@

    Methods

    async def get_all_roles(self, user_context: Dict[str, Any]) -> GetAllRolesOkResult:
         params = {}
         response = await self.querier.send_get_request(
    -        NormalisedURLPath("/recipe/roles"), params
    +        NormalisedURLPath("/recipe/roles"),
    +        params,
    +        user_context=user_context,
         )
         return GetAllRolesOkResult(roles=response["roles"])
    @@ -431,7 +470,9 @@

    Methods

    ) -> Union[GetPermissionsForRoleOkResult, UnknownRoleError]: params = {"role": role} response = await self.querier.send_get_request( - NormalisedURLPath("/recipe/role/permissions"), params + NormalisedURLPath("/recipe/role/permissions"), + params, + user_context=user_context, ) if response["status"] == "OK": return GetPermissionsForRoleOkResult(permissions=response["permissions"]) @@ -454,6 +495,7 @@

    Methods

    response = await self.querier.send_get_request( NormalisedURLPath(f"{tenant_id}/recipe/user/roles"), params, + user_context=user_context, ) return GetRolesForUserOkResult(roles=response["roles"])
    @@ -472,7 +514,9 @@

    Methods

    ) -> GetRolesThatHavePermissionOkResult: params = {"permission": permission} response = await self.querier.send_get_request( - NormalisedURLPath("/recipe/permission/roles"), params + NormalisedURLPath("/recipe/permission/roles"), + params, + user_context=user_context, ) return GetRolesThatHavePermissionOkResult(roles=response["roles"])
    @@ -493,6 +537,7 @@

    Methods

    response = await self.querier.send_get_request( NormalisedURLPath(f"{tenant_id}/recipe/role/users"), params, + user_context=user_context, ) if response["status"] == "OK": return GetUsersThatHaveRoleOkResult(users=response["users"]) @@ -513,7 +558,9 @@

    Methods

    ) -> Union[RemovePermissionsFromRoleOkResult, UnknownRoleError]: params = {"role": role, "permissions": permissions} response = await self.querier.send_post_request( - NormalisedURLPath("/recipe/role/permissions/remove"), params + NormalisedURLPath("/recipe/role/permissions/remove"), + params, + user_context=user_context, ) if response["status"] == "OK": return RemovePermissionsFromRoleOkResult() @@ -540,6 +587,7 @@

    Methods

    response = await self.querier.send_post_request( NormalisedURLPath(f"{tenant_id}/recipe/user/role/remove"), params, + user_context=user_context, ) if response["status"] == "OK": return RemoveUserRoleOkResult( diff --git a/html/supertokens_python/supertokens.html b/html/supertokens_python/supertokens.html index fd38c5631..c20c14048 100644 --- a/html/supertokens_python/supertokens.html +++ b/html/supertokens_python/supertokens.html @@ -43,7 +43,7 @@

    Module supertokens_python.supertokens

    from __future__ import annotations from os import environ -from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Set, Union +from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Set, Union, Tuple from typing_extensions import Literal @@ -52,7 +52,6 @@

    Module supertokens_python.supertokens

    log_debug_message, enable_debug_logging, ) - from .constants import FDI_KEY_HEADER, RID_KEY_HEADER, USER_COUNT, USER_DELETE, USERS from .exceptions import SuperTokensError from .interfaces import ( @@ -91,10 +90,32 @@

    Module supertokens_python.supertokens

    class SupertokensConfig: def __init__( - self, connection_uri: str, api_key: Union[str, None] = None + self, + connection_uri: str, + api_key: Union[str, None] = None, + network_interceptor: Optional[ + Callable[ + [ + str, + str, + Dict[str, Any], + Optional[Dict[str, Any]], + Optional[Dict[str, Any]], + Optional[Dict[str, Any]], + ], + Tuple[ + str, + str, + Dict[str, Any], + Optional[Dict[str, Any]], + Optional[Dict[str, Any]], + ], + ] + ] = None, ): # We keep this = None here because this is directly used by the user. self.connection_uri = connection_uri self.api_key = api_key + self.network_interceptor = network_interceptor class Host: @@ -214,7 +235,9 @@

    Module supertokens_python.supertokens

    filter(lambda x: x != "", supertokens_config.connection_uri.split(";")), ) ) - Querier.init(hosts, supertokens_config.api_key) + Querier.init( + hosts, supertokens_config.api_key, supertokens_config.network_interceptor + ) if len(recipe_list) == 0: raise_general_exception( @@ -298,6 +321,7 @@

    Module supertokens_python.supertokens

    self, include_recipe_ids: Union[None, List[str]], tenant_id: Optional[str] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> int: querier = Querier.get_instance(None) include_recipe_ids_str = None @@ -310,18 +334,25 @@

    Module supertokens_python.supertokens

    "includeRecipeIds": include_recipe_ids_str, "includeAllTenants": tenant_id is None, }, + user_context=user_context, ) return int(response["count"]) - async def delete_user(self, user_id: str) -> None: # pylint: disable=no-self-use + async def delete_user( # pylint: disable=no-self-use + self, + user_id: str, + user_context: Optional[Dict[str, Any]], + ) -> None: querier = Querier.get_instance(None) cdi_version = await querier.get_api_version() if is_version_gte(cdi_version, "2.10"): await querier.send_post_request( - NormalisedURLPath(USER_DELETE), {"userId": user_id} + NormalisedURLPath(USER_DELETE), + {"userId": user_id}, + user_context=user_context, ) return None @@ -334,7 +365,8 @@

    Module supertokens_python.supertokens

    limit: Union[int, None], pagination_token: Union[str, None], include_recipe_ids: Union[None, List[str]], - query: Union[Dict[str, str], None] = None, + query: Union[Dict[str, str], None], + user_context: Optional[Dict[str, Any]], ) -> UsersResponse: from supertokens_python.recipe.multitenancy.constants import DEFAULT_TENANT_ID @@ -357,7 +389,7 @@

    Module supertokens_python.supertokens

    tenant_id = DEFAULT_TENANT_ID response = await querier.send_get_request( - NormalisedURLPath(f"/{tenant_id}{USERS}"), params + NormalisedURLPath(f"/{tenant_id}{USERS}"), params, user_context=user_context ) next_pagination_token = None if "nextPaginationToken" in response: @@ -396,8 +428,9 @@

    Module supertokens_python.supertokens

    self, supertokens_user_id: str, external_user_id: str, - external_user_id_info: Optional[str] = None, - force: Optional[bool] = None, + external_user_id_info: Optional[str], + force: Optional[bool], + user_context: Optional[Dict[str, Any]], ) -> Union[ CreateUserIdMappingOkResult, UnknownSupertokensUserIDError, @@ -417,7 +450,7 @@

    Module supertokens_python.supertokens

    body["force"] = force res = await querier.send_post_request( - NormalisedURLPath("/recipe/userid/map"), body + NormalisedURLPath("/recipe/userid/map"), body, user_context=user_context ) if res["status"] == "OK": return CreateUserIdMappingOkResult() @@ -436,7 +469,8 @@

    Module supertokens_python.supertokens

    async def get_user_id_mapping( # pylint: disable=no-self-use self, user_id: str, - user_id_type: Optional[UserIDTypes] = None, + user_id_type: Optional[UserIDTypes], + user_context: Optional[Dict[str, Any]], ) -> Union[GetUserIdMappingOkResult, UnknownMappingError]: querier = Querier.get_instance(None) @@ -451,6 +485,7 @@

    Module supertokens_python.supertokens

    res = await querier.send_get_request( NormalisedURLPath("/recipe/userid/map"), body, + user_context=user_context, ) if res["status"] == "OK": return GetUserIdMappingOkResult( @@ -468,8 +503,9 @@

    Module supertokens_python.supertokens

    async def delete_user_id_mapping( # pylint: disable=no-self-use self, user_id: str, - user_id_type: Optional[UserIDTypes] = None, - force: Optional[bool] = None, + user_id_type: Optional[UserIDTypes], + force: Optional[bool], + user_context: Optional[Dict[str, Any]], ) -> DeleteUserIdMappingOkResult: querier = Querier.get_instance(None) @@ -483,7 +519,9 @@

    Module supertokens_python.supertokens

    if force: body["force"] = force res = await querier.send_post_request( - NormalisedURLPath("/recipe/userid/map/remove"), body + NormalisedURLPath("/recipe/userid/map/remove"), + body, + user_context=user_context, ) if res["status"] == "OK": return DeleteUserIdMappingOkResult( @@ -497,8 +535,9 @@

    Module supertokens_python.supertokens

    async def update_or_delete_user_id_mapping_info( # pylint: disable=no-self-use self, user_id: str, - user_id_type: Optional[UserIDTypes] = None, - external_user_id_info: Optional[str] = None, + user_id_type: Optional[UserIDTypes], + external_user_id_info: Optional[str], + user_context: Optional[Dict[str, Any]], ) -> Union[UpdateOrDeleteUserIdMappingInfoOkResult, UnknownMappingError]: querier = Querier.get_instance(None) @@ -512,6 +551,7 @@

    Module supertokens_python.supertokens

    "userIdType": user_id_type, "externalUserIdInfo": external_user_id_info, }, + user_context=user_context, ) if res["status"] == "OK": return UpdateOrDeleteUserIdMappingInfoOkResult() @@ -850,7 +890,9 @@

    Methods

    filter(lambda x: x != "", supertokens_config.connection_uri.split(";")), ) ) - Querier.init(hosts, supertokens_config.api_key) + Querier.init( + hosts, supertokens_config.api_key, supertokens_config.network_interceptor + ) if len(recipe_list) == 0: raise_general_exception( @@ -934,6 +976,7 @@

    Methods

    self, include_recipe_ids: Union[None, List[str]], tenant_id: Optional[str] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> int: querier = Querier.get_instance(None) include_recipe_ids_str = None @@ -946,18 +989,25 @@

    Methods

    "includeRecipeIds": include_recipe_ids_str, "includeAllTenants": tenant_id is None, }, + user_context=user_context, ) return int(response["count"]) - async def delete_user(self, user_id: str) -> None: # pylint: disable=no-self-use + async def delete_user( # pylint: disable=no-self-use + self, + user_id: str, + user_context: Optional[Dict[str, Any]], + ) -> None: querier = Querier.get_instance(None) cdi_version = await querier.get_api_version() if is_version_gte(cdi_version, "2.10"): await querier.send_post_request( - NormalisedURLPath(USER_DELETE), {"userId": user_id} + NormalisedURLPath(USER_DELETE), + {"userId": user_id}, + user_context=user_context, ) return None @@ -970,7 +1020,8 @@

    Methods

    limit: Union[int, None], pagination_token: Union[str, None], include_recipe_ids: Union[None, List[str]], - query: Union[Dict[str, str], None] = None, + query: Union[Dict[str, str], None], + user_context: Optional[Dict[str, Any]], ) -> UsersResponse: from supertokens_python.recipe.multitenancy.constants import DEFAULT_TENANT_ID @@ -993,7 +1044,7 @@

    Methods

    tenant_id = DEFAULT_TENANT_ID response = await querier.send_get_request( - NormalisedURLPath(f"/{tenant_id}{USERS}"), params + NormalisedURLPath(f"/{tenant_id}{USERS}"), params, user_context=user_context ) next_pagination_token = None if "nextPaginationToken" in response: @@ -1032,8 +1083,9 @@

    Methods

    self, supertokens_user_id: str, external_user_id: str, - external_user_id_info: Optional[str] = None, - force: Optional[bool] = None, + external_user_id_info: Optional[str], + force: Optional[bool], + user_context: Optional[Dict[str, Any]], ) -> Union[ CreateUserIdMappingOkResult, UnknownSupertokensUserIDError, @@ -1053,7 +1105,7 @@

    Methods

    body["force"] = force res = await querier.send_post_request( - NormalisedURLPath("/recipe/userid/map"), body + NormalisedURLPath("/recipe/userid/map"), body, user_context=user_context ) if res["status"] == "OK": return CreateUserIdMappingOkResult() @@ -1072,7 +1124,8 @@

    Methods

    async def get_user_id_mapping( # pylint: disable=no-self-use self, user_id: str, - user_id_type: Optional[UserIDTypes] = None, + user_id_type: Optional[UserIDTypes], + user_context: Optional[Dict[str, Any]], ) -> Union[GetUserIdMappingOkResult, UnknownMappingError]: querier = Querier.get_instance(None) @@ -1087,6 +1140,7 @@

    Methods

    res = await querier.send_get_request( NormalisedURLPath("/recipe/userid/map"), body, + user_context=user_context, ) if res["status"] == "OK": return GetUserIdMappingOkResult( @@ -1104,8 +1158,9 @@

    Methods

    async def delete_user_id_mapping( # pylint: disable=no-self-use self, user_id: str, - user_id_type: Optional[UserIDTypes] = None, - force: Optional[bool] = None, + user_id_type: Optional[UserIDTypes], + force: Optional[bool], + user_context: Optional[Dict[str, Any]], ) -> DeleteUserIdMappingOkResult: querier = Querier.get_instance(None) @@ -1119,7 +1174,9 @@

    Methods

    if force: body["force"] = force res = await querier.send_post_request( - NormalisedURLPath("/recipe/userid/map/remove"), body + NormalisedURLPath("/recipe/userid/map/remove"), + body, + user_context=user_context, ) if res["status"] == "OK": return DeleteUserIdMappingOkResult( @@ -1133,8 +1190,9 @@

    Methods

    async def update_or_delete_user_id_mapping_info( # pylint: disable=no-self-use self, user_id: str, - user_id_type: Optional[UserIDTypes] = None, - external_user_id_info: Optional[str] = None, + user_id_type: Optional[UserIDTypes], + external_user_id_info: Optional[str], + user_context: Optional[Dict[str, Any]], ) -> Union[UpdateOrDeleteUserIdMappingInfoOkResult, UnknownMappingError]: querier = Querier.get_instance(None) @@ -1148,6 +1206,7 @@

    Methods

    "userIdType": user_id_type, "externalUserIdInfo": external_user_id_info, }, + user_context=user_context, ) if res["status"] == "OK": return UpdateOrDeleteUserIdMappingInfoOkResult() @@ -1361,7 +1420,7 @@

    Static methods

    Methods

    -async def create_user_id_mapping(self, supertokens_user_id: str, external_user_id: str, external_user_id_info: Optional[str] = None, force: Optional[bool] = None) ‑> Union[CreateUserIdMappingOkResultUnknownSupertokensUserIDErrorUserIdMappingAlreadyExistsError] +async def create_user_id_mapping(self, supertokens_user_id: str, external_user_id: str, external_user_id_info: Optional[str], force: Optional[bool], user_context: Optional[Dict[str, Any]]) ‑> Union[CreateUserIdMappingOkResultUnknownSupertokensUserIDErrorUserIdMappingAlreadyExistsError]
    @@ -1373,8 +1432,9 @@

    Methods

    self, supertokens_user_id: str, external_user_id: str, - external_user_id_info: Optional[str] = None, - force: Optional[bool] = None, + external_user_id_info: Optional[str], + force: Optional[bool], + user_context: Optional[Dict[str, Any]], ) -> Union[ CreateUserIdMappingOkResult, UnknownSupertokensUserIDError, @@ -1394,7 +1454,7 @@

    Methods

    body["force"] = force res = await querier.send_post_request( - NormalisedURLPath("/recipe/userid/map"), body + NormalisedURLPath("/recipe/userid/map"), body, user_context=user_context ) if res["status"] == "OK": return CreateUserIdMappingOkResult() @@ -1412,7 +1472,7 @@

    Methods

    -async def delete_user(self, user_id: str) ‑> None +async def delete_user(self, user_id: str, user_context: Optional[Dict[str, Any]]) ‑> None
    @@ -1420,14 +1480,20 @@

    Methods

    Expand source code -
    async def delete_user(self, user_id: str) -> None:  # pylint: disable=no-self-use
    +
    async def delete_user(  # pylint: disable=no-self-use
    +    self,
    +    user_id: str,
    +    user_context: Optional[Dict[str, Any]],
    +) -> None:
         querier = Querier.get_instance(None)
     
         cdi_version = await querier.get_api_version()
     
         if is_version_gte(cdi_version, "2.10"):
             await querier.send_post_request(
    -            NormalisedURLPath(USER_DELETE), {"userId": user_id}
    +            NormalisedURLPath(USER_DELETE),
    +            {"userId": user_id},
    +            user_context=user_context,
             )
     
             return None
    @@ -1435,7 +1501,7 @@ 

    Methods

    -async def delete_user_id_mapping(self, user_id: str, user_id_type: Optional[UserIDTypes] = None, force: Optional[bool] = None) ‑> DeleteUserIdMappingOkResult +async def delete_user_id_mapping(self, user_id: str, user_id_type: Optional[UserIDTypes], force: Optional[bool], user_context: Optional[Dict[str, Any]]) ‑> DeleteUserIdMappingOkResult
    @@ -1446,8 +1512,9 @@

    Methods

    async def delete_user_id_mapping(  # pylint: disable=no-self-use
         self,
         user_id: str,
    -    user_id_type: Optional[UserIDTypes] = None,
    -    force: Optional[bool] = None,
    +    user_id_type: Optional[UserIDTypes],
    +    force: Optional[bool],
    +    user_context: Optional[Dict[str, Any]],
     ) -> DeleteUserIdMappingOkResult:
         querier = Querier.get_instance(None)
     
    @@ -1461,7 +1528,9 @@ 

    Methods

    if force: body["force"] = force res = await querier.send_post_request( - NormalisedURLPath("/recipe/userid/map/remove"), body + NormalisedURLPath("/recipe/userid/map/remove"), + body, + user_context=user_context, ) if res["status"] == "OK": return DeleteUserIdMappingOkResult( @@ -1520,7 +1589,7 @@

    Methods

    -async def get_user_count(self, include_recipe_ids: Union[None, List[str]], tenant_id: Optional[str] = None) ‑> int +async def get_user_count(self, include_recipe_ids: Union[None, List[str]], tenant_id: Optional[str] = None, user_context: Optional[Dict[str, Any]] = None) ‑> int
    @@ -1532,6 +1601,7 @@

    Methods

    self, include_recipe_ids: Union[None, List[str]], tenant_id: Optional[str] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> int: querier = Querier.get_instance(None) include_recipe_ids_str = None @@ -1544,13 +1614,14 @@

    Methods

    "includeRecipeIds": include_recipe_ids_str, "includeAllTenants": tenant_id is None, }, + user_context=user_context, ) return int(response["count"])
    -async def get_user_id_mapping(self, user_id: str, user_id_type: Optional[UserIDTypes] = None) ‑> Union[GetUserIdMappingOkResultUnknownMappingError] +async def get_user_id_mapping(self, user_id: str, user_id_type: Optional[UserIDTypes], user_context: Optional[Dict[str, Any]]) ‑> Union[GetUserIdMappingOkResultUnknownMappingError]
    @@ -1561,7 +1632,8 @@

    Methods

    async def get_user_id_mapping(  # pylint: disable=no-self-use
         self,
         user_id: str,
    -    user_id_type: Optional[UserIDTypes] = None,
    +    user_id_type: Optional[UserIDTypes],
    +    user_context: Optional[Dict[str, Any]],
     ) -> Union[GetUserIdMappingOkResult, UnknownMappingError]:
         querier = Querier.get_instance(None)
     
    @@ -1576,6 +1648,7 @@ 

    Methods

    res = await querier.send_get_request( NormalisedURLPath("/recipe/userid/map"), body, + user_context=user_context, ) if res["status"] == "OK": return GetUserIdMappingOkResult( @@ -1592,7 +1665,7 @@

    Methods

    -async def get_users(self, tenant_id: str, time_joined_order: "Literal['ASC', 'DESC']", limit: Union[int, None], pagination_token: Union[str, None], include_recipe_ids: Union[None, List[str]], query: Union[Dict[str, str], None] = None) ‑> UsersResponse +async def get_users(self, tenant_id: str, time_joined_order: "Literal['ASC', 'DESC']", limit: Union[int, None], pagination_token: Union[str, None], include_recipe_ids: Union[None, List[str]], query: Union[Dict[str, str], None], user_context: Optional[Dict[str, Any]]) ‑> UsersResponse
    @@ -1607,7 +1680,8 @@

    Methods

    limit: Union[int, None], pagination_token: Union[str, None], include_recipe_ids: Union[None, List[str]], - query: Union[Dict[str, str], None] = None, + query: Union[Dict[str, str], None], + user_context: Optional[Dict[str, Any]], ) -> UsersResponse: from supertokens_python.recipe.multitenancy.constants import DEFAULT_TENANT_ID @@ -1630,7 +1704,7 @@

    Methods

    tenant_id = DEFAULT_TENANT_ID response = await querier.send_get_request( - NormalisedURLPath(f"/{tenant_id}{USERS}"), params + NormalisedURLPath(f"/{tenant_id}{USERS}"), params, user_context=user_context ) next_pagination_token = None if "nextPaginationToken" in response: @@ -1800,7 +1874,7 @@

    Methods

    -async def update_or_delete_user_id_mapping_info(self, user_id: str, user_id_type: Optional[UserIDTypes] = None, external_user_id_info: Optional[str] = None) ‑> Union[UpdateOrDeleteUserIdMappingInfoOkResultUnknownMappingError] +async def update_or_delete_user_id_mapping_info(self, user_id: str, user_id_type: Optional[UserIDTypes], external_user_id_info: Optional[str], user_context: Optional[Dict[str, Any]]) ‑> Union[UpdateOrDeleteUserIdMappingInfoOkResultUnknownMappingError]
    @@ -1811,8 +1885,9 @@

    Methods

    async def update_or_delete_user_id_mapping_info(  # pylint: disable=no-self-use
         self,
         user_id: str,
    -    user_id_type: Optional[UserIDTypes] = None,
    -    external_user_id_info: Optional[str] = None,
    +    user_id_type: Optional[UserIDTypes],
    +    external_user_id_info: Optional[str],
    +    user_context: Optional[Dict[str, Any]],
     ) -> Union[UpdateOrDeleteUserIdMappingInfoOkResult, UnknownMappingError]:
         querier = Querier.get_instance(None)
     
    @@ -1826,6 +1901,7 @@ 

    Methods

    "userIdType": user_id_type, "externalUserIdInfo": external_user_id_info, }, + user_context=user_context, ) if res["status"] == "OK": return UpdateOrDeleteUserIdMappingInfoOkResult() @@ -1841,7 +1917,7 @@

    Methods

    class SupertokensConfig -(connection_uri: str, api_key: Union[str, None] = None) +(connection_uri: str, api_key: Union[str, None] = None, network_interceptor: Optional[Callable[[str, str, Dict[str, Any], Optional[Dict[str, Any]], Optional[Dict[str, Any]], Optional[Dict[str, Any]]], Tuple[str, str, Dict[str, Any], Optional[Dict[str, Any]], Optional[Dict[str, Any]]]]] = None)
    @@ -1851,10 +1927,32 @@

    Methods

    class SupertokensConfig:
         def __init__(
    -        self, connection_uri: str, api_key: Union[str, None] = None
    +        self,
    +        connection_uri: str,
    +        api_key: Union[str, None] = None,
    +        network_interceptor: Optional[
    +            Callable[
    +                [
    +                    str,
    +                    str,
    +                    Dict[str, Any],
    +                    Optional[Dict[str, Any]],
    +                    Optional[Dict[str, Any]],
    +                    Optional[Dict[str, Any]],
    +                ],
    +                Tuple[
    +                    str,
    +                    str,
    +                    Dict[str, Any],
    +                    Optional[Dict[str, Any]],
    +                    Optional[Dict[str, Any]],
    +                ],
    +            ]
    +        ] = None,
         ):  # We keep this = None here because this is directly used by the user.
             self.connection_uri = connection_uri
    -        self.api_key = api_key
    + self.api_key = api_key + self.network_interceptor = network_interceptor
    diff --git a/html/supertokens_python/syncio/index.html b/html/supertokens_python/syncio/index.html index 960aaf061..74019a45c 100644 --- a/html/supertokens_python/syncio/index.html +++ b/html/supertokens_python/syncio/index.html @@ -39,7 +39,7 @@

    Module supertokens_python.syncio

    # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, Union, Any from supertokens_python import Supertokens from supertokens_python.async_to_sync_wrapper import sync @@ -62,10 +62,17 @@

    Module supertokens_python.syncio

    pagination_token: Union[str, None] = None, include_recipe_ids: Union[None, List[str]] = None, query: Union[None, Dict[str, str]] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> UsersResponse: return sync( Supertokens.get_instance().get_users( - tenant_id, "ASC", limit, pagination_token, include_recipe_ids, query + tenant_id, + "ASC", + limit, + pagination_token, + include_recipe_ids, + query, + user_context, ) ) @@ -76,10 +83,17 @@

    Module supertokens_python.syncio

    pagination_token: Union[str, None] = None, include_recipe_ids: Union[None, List[str]] = None, query: Union[None, Dict[str, str]] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> UsersResponse: return sync( Supertokens.get_instance().get_users( - tenant_id, "DESC", limit, pagination_token, include_recipe_ids, query + tenant_id, + "DESC", + limit, + pagination_token, + include_recipe_ids, + query, + user_context, ) ) @@ -87,20 +101,25 @@

    Module supertokens_python.syncio

    def get_user_count( include_recipe_ids: Union[None, List[str]] = None, tenant_id: Optional[str] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> int: return sync( - Supertokens.get_instance().get_user_count(include_recipe_ids, tenant_id) + Supertokens.get_instance().get_user_count( + include_recipe_ids, tenant_id, user_context + ) ) -def delete_user(user_id: str) -> None: - return sync(Supertokens.get_instance().delete_user(user_id)) +def delete_user(user_id: str, user_context: Optional[Dict[str, Any]] = None) -> None: + return sync(Supertokens.get_instance().delete_user(user_id, user_context)) def create_user_id_mapping( supertokens_user_id: str, external_user_id: str, external_user_id_info: Optional[str] = None, + force: Optional[bool] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> Union[ CreateUserIdMappingOkResult, UnknownSupertokensUserIDError, @@ -108,7 +127,11 @@

    Module supertokens_python.syncio

    ]: return sync( Supertokens.get_instance().create_user_id_mapping( - supertokens_user_id, external_user_id, external_user_id_info + supertokens_user_id, + external_user_id, + external_user_id_info, + force=force, + user_context=user_context, ) ) @@ -116,15 +139,25 @@

    Module supertokens_python.syncio

    def get_user_id_mapping( user_id: str, user_id_type: Optional[UserIDTypes] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> Union[GetUserIdMappingOkResult, UnknownMappingError]: - return sync(Supertokens.get_instance().get_user_id_mapping(user_id, user_id_type)) + return sync( + Supertokens.get_instance().get_user_id_mapping( + user_id, user_id_type, user_context + ) + ) def delete_user_id_mapping( - user_id: str, user_id_type: Optional[UserIDTypes] = None + user_id: str, + user_id_type: Optional[UserIDTypes] = None, + force: Optional[bool] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> DeleteUserIdMappingOkResult: return sync( - Supertokens.get_instance().delete_user_id_mapping(user_id, user_id_type) + Supertokens.get_instance().delete_user_id_mapping( + user_id, user_id_type, force=force, user_context=user_context + ) ) @@ -132,10 +165,11 @@

    Module supertokens_python.syncio

    user_id: str, user_id_type: Optional[UserIDTypes] = None, external_user_id_info: Optional[str] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> Union[UpdateOrDeleteUserIdMappingInfoOkResult, UnknownMappingError]: return sync( Supertokens.get_instance().update_or_delete_user_id_mapping_info( - user_id, user_id_type, external_user_id_info + user_id, user_id_type, external_user_id_info, user_context ) )
    @@ -148,7 +182,7 @@

    Module supertokens_python.syncio

    Functions

    -def create_user_id_mapping(supertokens_user_id: str, external_user_id: str, external_user_id_info: Optional[str] = None) ‑> Union[CreateUserIdMappingOkResultUnknownSupertokensUserIDErrorUserIdMappingAlreadyExistsError] +def create_user_id_mapping(supertokens_user_id: str, external_user_id: str, external_user_id_info: Optional[str] = None, force: Optional[bool] = None, user_context: Optional[Dict[str, Any]] = None) ‑> Union[CreateUserIdMappingOkResultUnknownSupertokensUserIDErrorUserIdMappingAlreadyExistsError]
    @@ -160,6 +194,8 @@

    Functions

    supertokens_user_id: str, external_user_id: str, external_user_id_info: Optional[str] = None, + force: Optional[bool] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> Union[ CreateUserIdMappingOkResult, UnknownSupertokensUserIDError, @@ -167,13 +203,17 @@

    Functions

    ]: return sync( Supertokens.get_instance().create_user_id_mapping( - supertokens_user_id, external_user_id, external_user_id_info + supertokens_user_id, + external_user_id, + external_user_id_info, + force=force, + user_context=user_context, ) )
    -def delete_user(user_id: str) ‑> None +def delete_user(user_id: str, user_context: Optional[Dict[str, Any]] = None) ‑> None
    @@ -181,12 +221,12 @@

    Functions

    Expand source code -
    def delete_user(user_id: str) -> None:
    -    return sync(Supertokens.get_instance().delete_user(user_id))
    +
    def delete_user(user_id: str, user_context: Optional[Dict[str, Any]] = None) -> None:
    +    return sync(Supertokens.get_instance().delete_user(user_id, user_context))
    -def delete_user_id_mapping(user_id: str, user_id_type: Optional[Literal['SUPERTOKENS', 'EXTERNAL', 'ANY']] = None) ‑> DeleteUserIdMappingOkResult +def delete_user_id_mapping(user_id: str, user_id_type: Optional[Literal['SUPERTOKENS', 'EXTERNAL', 'ANY']] = None, force: Optional[bool] = None, user_context: Optional[Dict[str, Any]] = None) ‑> DeleteUserIdMappingOkResult
    @@ -195,15 +235,20 @@

    Functions

    Expand source code
    def delete_user_id_mapping(
    -    user_id: str, user_id_type: Optional[UserIDTypes] = None
    +    user_id: str,
    +    user_id_type: Optional[UserIDTypes] = None,
    +    force: Optional[bool] = None,
    +    user_context: Optional[Dict[str, Any]] = None,
     ) -> DeleteUserIdMappingOkResult:
         return sync(
    -        Supertokens.get_instance().delete_user_id_mapping(user_id, user_id_type)
    +        Supertokens.get_instance().delete_user_id_mapping(
    +            user_id, user_id_type, force=force, user_context=user_context
    +        )
         )
    -def get_user_count(include_recipe_ids: Optional[None] = None, tenant_id: Optional[str] = None) ‑> int +def get_user_count(include_recipe_ids: Optional[None] = None, tenant_id: Optional[str] = None, user_context: Optional[Dict[str, Any]] = None) ‑> int
    @@ -214,14 +259,17 @@

    Functions

    def get_user_count(
         include_recipe_ids: Union[None, List[str]] = None,
         tenant_id: Optional[str] = None,
    +    user_context: Optional[Dict[str, Any]] = None,
     ) -> int:
         return sync(
    -        Supertokens.get_instance().get_user_count(include_recipe_ids, tenant_id)
    +        Supertokens.get_instance().get_user_count(
    +            include_recipe_ids, tenant_id, user_context
    +        )
         )
    -def get_user_id_mapping(user_id: str, user_id_type: Optional[Literal['SUPERTOKENS', 'EXTERNAL', 'ANY']] = None) ‑> Union[GetUserIdMappingOkResultUnknownMappingError] +def get_user_id_mapping(user_id: str, user_id_type: Optional[Literal['SUPERTOKENS', 'EXTERNAL', 'ANY']] = None, user_context: Optional[Dict[str, Any]] = None) ‑> Union[GetUserIdMappingOkResultUnknownMappingError]
    @@ -232,12 +280,17 @@

    Functions

    def get_user_id_mapping(
         user_id: str,
         user_id_type: Optional[UserIDTypes] = None,
    +    user_context: Optional[Dict[str, Any]] = None,
     ) -> Union[GetUserIdMappingOkResult, UnknownMappingError]:
    -    return sync(Supertokens.get_instance().get_user_id_mapping(user_id, user_id_type))
    + return sync( + Supertokens.get_instance().get_user_id_mapping( + user_id, user_id_type, user_context + ) + )
    -def get_users_newest_first(tenant_id: str, limit: Optional[int] = None, pagination_token: Optional[str] = None, include_recipe_ids: Optional[None] = None, query: Optional[None] = None) ‑> UsersResponse +def get_users_newest_first(tenant_id: str, limit: Optional[int] = None, pagination_token: Optional[str] = None, include_recipe_ids: Optional[None] = None, query: Optional[None] = None, user_context: Optional[Dict[str, Any]] = None) ‑> UsersResponse
    @@ -251,16 +304,23 @@

    Functions

    pagination_token: Union[str, None] = None, include_recipe_ids: Union[None, List[str]] = None, query: Union[None, Dict[str, str]] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> UsersResponse: return sync( Supertokens.get_instance().get_users( - tenant_id, "DESC", limit, pagination_token, include_recipe_ids, query + tenant_id, + "DESC", + limit, + pagination_token, + include_recipe_ids, + query, + user_context, ) )
    -def get_users_oldest_first(tenant_id: str, limit: Optional[int] = None, pagination_token: Optional[str] = None, include_recipe_ids: Optional[None] = None, query: Optional[None] = None) ‑> UsersResponse +def get_users_oldest_first(tenant_id: str, limit: Optional[int] = None, pagination_token: Optional[str] = None, include_recipe_ids: Optional[None] = None, query: Optional[None] = None, user_context: Optional[Dict[str, Any]] = None) ‑> UsersResponse
    @@ -274,16 +334,23 @@

    Functions

    pagination_token: Union[str, None] = None, include_recipe_ids: Union[None, List[str]] = None, query: Union[None, Dict[str, str]] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> UsersResponse: return sync( Supertokens.get_instance().get_users( - tenant_id, "ASC", limit, pagination_token, include_recipe_ids, query + tenant_id, + "ASC", + limit, + pagination_token, + include_recipe_ids, + query, + user_context, ) )
    -def update_or_delete_user_id_mapping_info(user_id: str, user_id_type: Optional[Literal['SUPERTOKENS', 'EXTERNAL', 'ANY']] = None, external_user_id_info: Optional[str] = None) ‑> Union[UpdateOrDeleteUserIdMappingInfoOkResultUnknownMappingError] +def update_or_delete_user_id_mapping_info(user_id: str, user_id_type: Optional[Literal['SUPERTOKENS', 'EXTERNAL', 'ANY']] = None, external_user_id_info: Optional[str] = None, user_context: Optional[Dict[str, Any]] = None) ‑> Union[UpdateOrDeleteUserIdMappingInfoOkResultUnknownMappingError]
    @@ -295,10 +362,11 @@

    Functions

    user_id: str, user_id_type: Optional[UserIDTypes] = None, external_user_id_info: Optional[str] = None, + user_context: Optional[Dict[str, Any]] = None, ) -> Union[UpdateOrDeleteUserIdMappingInfoOkResult, UnknownMappingError]: return sync( Supertokens.get_instance().update_or_delete_user_id_mapping_info( - user_id, user_id_type, external_user_id_info + user_id, user_id_type, external_user_id_info, user_context ) )