Skip to content

change config parameter name #576

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 32 additions & 18 deletions supertokens_python/supertokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,19 @@ def __init__(
api_domain: str,
api_gateway_path: str = "",
api_base_path: str = "/auth",
website_base_path: str = "/auth",
website_domain: Optional[str] = None,
client_base_path: str = "/auth",
client_domain: Optional[str] = None,
origin: Optional[
Union[str, Callable[[Optional[BaseRequest], Dict[str, Any]], str]]
] = None,
):
self.app_name = app_name
self.api_gateway_path = api_gateway_path
self.api_domain = api_domain
self.website_domain = website_domain
self.client_domain = client_domain
self.origin = origin
self.api_base_path = api_base_path
self.website_base_path = website_base_path
self.client_base_path = client_base_path


class AppInfo:
Expand Down Expand Up @@ -238,9 +238,11 @@ def __init__(
hosts = list(
map(
lambda h: Host(
NormalisedURLDomain(h.strip()), NormalisedURLPath(h.strip())
NormalisedURLDomain(
h.strip()), NormalisedURLPath(h.strip())
),
filter(lambda x: x != "", supertokens_config.connection_uri.split(";")),
filter(lambda x: x != "",
supertokens_config.connection_uri.split(";")),
)
)
Querier.init(
Expand Down Expand Up @@ -289,7 +291,8 @@ def make_recipe(recipe: Callable[[AppInfo], RecipeModule]) -> RecipeModule:
jwt_found = True
return recipe_module

self.recipe_modules: List[RecipeModule] = list(map(make_recipe, recipe_list))
self.recipe_modules: List[RecipeModule] = list(
map(make_recipe, recipe_list))

if not jwt_found:
from supertokens_python.recipe.jwt.recipe import JWTRecipe
Expand All @@ -304,22 +307,26 @@ def make_recipe(recipe: Callable[[AppInfo], RecipeModule]) -> RecipeModule:
if not multitenancy_found:
from supertokens_python.recipe.multitenancy.recipe import MultitenancyRecipe

self.recipe_modules.append(MultitenancyRecipe.init()(self.app_info))
self.recipe_modules.append(
MultitenancyRecipe.init()(self.app_info))

if totp_found and not multi_factor_auth_found:
raise Exception("Please initialize the MultiFactorAuth recipe to use TOTP.")
raise Exception(
"Please initialize the MultiFactorAuth recipe to use TOTP.")

if not user_metadata_found:
from supertokens_python.recipe.usermetadata.recipe import UserMetadataRecipe

self.recipe_modules.append(UserMetadataRecipe.init()(self.app_info))
self.recipe_modules.append(
UserMetadataRecipe.init()(self.app_info))

if not oauth2_found:
from supertokens_python.recipe.oauth2provider.recipe import (
OAuth2ProviderRecipe,
)

self.recipe_modules.append(OAuth2ProviderRecipe.init()(self.app_info))
self.recipe_modules.append(
OAuth2ProviderRecipe.init()(self.app_info))

self.telemetry = (
telemetry
Expand Down Expand Up @@ -354,7 +361,8 @@ def reset():
if ("SUPERTOKENS_ENV" not in environ) or (
environ["SUPERTOKENS_ENV"] != "testing"
):
raise_general_exception("calling testing function in non testing env")
raise_general_exception(
"calling testing function in non testing env")
from supertokens_python.recipe.usermetadata.recipe import UserMetadataRecipe

UserMetadataRecipe.reset()
Expand Down Expand Up @@ -442,7 +450,8 @@ async def create_user_id_mapping(

raise_general_exception("Unknown response")

raise_general_exception("Please upgrade the SuperTokens core to >= 3.15.0")
raise_general_exception(
"Please upgrade the SuperTokens core to >= 3.15.0")

async def get_user_id_mapping(
self,
Expand Down Expand Up @@ -476,7 +485,8 @@ async def get_user_id_mapping(

raise_general_exception("Unknown response")

raise_general_exception("Please upgrade the SuperTokens core to >= 3.15.0")
raise_general_exception(
"Please upgrade the SuperTokens core to >= 3.15.0")

async def delete_user_id_mapping(
self,
Expand Down Expand Up @@ -508,7 +518,8 @@ async def delete_user_id_mapping(

raise_general_exception("Unknown response")

raise_general_exception("Please upgrade the SuperTokens core to >= 3.15.0")
raise_general_exception(
"Please upgrade the SuperTokens core to >= 3.15.0")

async def update_or_delete_user_id_mapping_info(
self,
Expand Down Expand Up @@ -538,7 +549,8 @@ async def update_or_delete_user_id_mapping_info(

raise_general_exception("Unknown response")

raise_general_exception("Please upgrade the SuperTokens core to >= 3.15.0")
raise_general_exception(
"Please upgrade the SuperTokens core to >= 3.15.0")

async def middleware(
self, request: BaseRequest, response: BaseResponse, user_context: Dict[str, Any]
Expand Down Expand Up @@ -595,7 +607,8 @@ async def handle_without_rid():
return None
log_debug_message("middleware: Ended")
return api_resp
log_debug_message("middleware: Not handling because no recipe matched")
log_debug_message(
"middleware: Not handling because no recipe matched")
return None

if request_rid is not None:
Expand Down Expand Up @@ -672,7 +685,8 @@ async def handle_supertokens_error(
) -> Optional[BaseResponse]:
log_debug_message("errorHandler: Started")
log_debug_message(
"errorHandler: Error is from SuperTokens recipe. Message: %s", str(err)
"errorHandler: Error is from SuperTokens recipe. Message: %s", str(
err)
)
if isinstance(err, GeneralError):
raise err
Expand Down
Loading