Skip to content

Commit 5ada8ab

Browse files
committed
added base url to DescopeClient
1 parent 68d46b0 commit 5ada8ab

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

descope/descope_client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class DescopeClient:
2727
def __init__(
2828
self,
2929
project_id: str,
30+
base_url: Optional[str] = None,
3031
public_key: Optional[dict] = None,
3132
skip_verify: bool = False,
3233
management_key: Optional[str] = None,
@@ -50,6 +51,7 @@ def __init__(
5051
# Auth Initialization
5152
auth_http_client = HTTPClient(
5253
project_id=project_id,
54+
base_url=base_url,
5355
timeout_seconds=timeout_seconds,
5456
secure=not skip_verify,
5557
management_key=auth_management_key

tests/test_descope_client.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,21 @@ def test_auth_management_key_with_refresh_token(self):
10521052
timeout=DEFAULT_TIMEOUT_SECONDS,
10531053
)
10541054

1055+
def test_base_url_setting(self):
1056+
"""Test that base_url parameter is correctly set in DescopeClient"""
1057+
custom_base_url = "https://api.use1.descope.com"
1058+
client = DescopeClient(
1059+
project_id=self.dummy_project_id,
1060+
base_url=custom_base_url,
1061+
public_key=self.public_key_dict,
1062+
)
1063+
1064+
# Verify that the base_url is set in the auth HTTP client
1065+
self.assertEqual(client._auth.http_client.base_url, custom_base_url)
1066+
1067+
# Verify that the base_url is set in the mgmt HTTP client
1068+
self.assertEqual(client._mgmt._http.base_url, custom_base_url)
1069+
10551070

10561071
if __name__ == "__main__":
10571072
unittest.main()

0 commit comments

Comments
 (0)