Skip to content

Commit 1a18051

Browse files
authored
fix(dms): warning for direct client creation and completed timeout flows
FIX: added warning for direct client creation and completed flow for …
2 parents 86f0e28 + d4e31cb commit 1a18051

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

‎src/sap_cloud_sdk/dms/__init__.py‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,17 @@ def create_client(
3838
*,
3939
instance: Optional[str] = None,
4040
dms_cred: Optional[DMSCredentials] = None,
41+
connect_timeout: Optional[int] = None,
42+
read_timeout: Optional[int] = None,
4143
_telemetry_source: Optional[Module] = None,
4244
):
4345
"""Create a DMS client with automatic credential resolution.
4446
4547
Args:
4648
instance: Logical instance name for secret resolution. Defaults to ``"default"``.
4749
dms_cred: Explicit credentials. If provided, skips secret resolution.
50+
connect_timeout: TCP connection timeout in seconds. Defaults to 10.
51+
read_timeout: Response read timeout in seconds. Defaults to 30.
4852
_telemetry_source: Internal telemetry source identifier. Not intended for external use.
4953
5054
Returns:
@@ -55,7 +59,11 @@ def create_client(
5559
"""
5660
try:
5761
credentials = dms_cred or load_sdm_config_from_env_or_mount(instance)
58-
client = DMSClient(credentials)
62+
client = DMSClient(
63+
credentials,
64+
connect_timeout=connect_timeout,
65+
read_timeout=read_timeout,
66+
)
5967
client._telemetry_source = _telemetry_source
6068
return client
6169
except Exception as e:

‎src/sap_cloud_sdk/dms/client.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ def __init__(
8989
) -> None:
9090
"""Initialise a DMSClient.
9191
92+
Note:
93+
Do not call this constructor directly. Use create_client() from
94+
sap_cloud_sdk.dms instead, which properly configures
95+
authentication and handles environment detection.
96+
9297
Args:
9398
credentials: OAuth2 credentials and service URI for the DMS instance.
9499
connect_timeout: TCP connection timeout in seconds. Defaults to 10.

0 commit comments

Comments
 (0)