datamasque-python 1.5.0__py3-none-any.whl → 1.5.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
datamasque/client/base.py CHANGED
@@ -138,6 +138,7 @@ class BaseClient:
138
138
  self.verify_ssl = connection_config.verify_ssl
139
139
  self.token_source = connection_config.token_source
140
140
  self._session = _build_session(self.verify_ssl)
141
+ self._timeout = (connection_config.connect_timeout_seconds, connection_config.read_timeout_seconds)
141
142
  if connection_config.spcs_pat:
142
143
  install_spcs_gateway_auth(self._session, connection_config.spcs_pat)
143
144
 
@@ -252,8 +253,11 @@ class BaseClient:
252
253
  params=params,
253
254
  headers=headers,
254
255
  files=files_payload,
256
+ timeout=self._timeout,
255
257
  )
256
- return self._session.request(method, url, json=data, params=params, headers=headers)
258
+ return self._session.request(
259
+ method, url, json=data, params=params, headers=headers, timeout=self._timeout
260
+ )
257
261
  except requests.RequestException as e:
258
262
  raise DataMasqueTransportError(f"Failed to reach DataMasque server at {url}: {e}") from e
259
263
 
datamasque/client/ifm.py CHANGED
@@ -85,6 +85,7 @@ class DataMasqueIfmClient:
85
85
  # One session for both admin-server (JWT login/refresh) and IFM (data plane)
86
86
  # traffic -- different hosts, but a single session handles per-host pooling.
87
87
  self._session = _build_session(self.verify_ssl)
88
+ self._timeout = (connection_config.connect_timeout_seconds, connection_config.read_timeout_seconds)
88
89
 
89
90
  def authenticate(self) -> None:
90
91
  """Obtain an access (and refresh) token from the admin server, or via `token_source`."""
@@ -101,6 +102,7 @@ class DataMasqueIfmClient:
101
102
  response = self._session.post(
102
103
  login_url,
103
104
  json={"username": self.username, "password": self.password},
105
+ timeout=self._timeout,
104
106
  )
105
107
  except requests.RequestException as e:
106
108
  raise DataMasqueTransportError(f"Failed to reach admin server at {login_url}: {e}") from e
@@ -127,6 +129,7 @@ class DataMasqueIfmClient:
127
129
  response = self._session.post(
128
130
  refresh_url,
129
131
  json={"refresh": self.refresh_token},
132
+ timeout=self._timeout,
130
133
  )
131
134
  except requests.RequestException as e:
132
135
  raise DataMasqueTransportError(f"Failed to reach admin server at {refresh_url}: {e}") from e
@@ -194,6 +197,7 @@ class DataMasqueIfmClient:
194
197
  json=json_body,
195
198
  params=params,
196
199
  headers={"Authorization": f"Bearer {self.access_token}"},
200
+ timeout=self._timeout,
197
201
  )
198
202
  except requests.RequestException as e:
199
203
  raise DataMasqueTransportError(f"Failed to reach IFM server at {url}: {e}") from e
@@ -4,6 +4,9 @@ from pydantic import BaseModel, ConfigDict, model_validator
4
4
 
5
5
  from datamasque.client.exceptions import DataMasqueUserError
6
6
 
7
+ DEFAULT_CONNECT_TIMEOUT_SECONDS = 10.0
8
+ DEFAULT_READ_TIMEOUT_SECONDS = 300.0
9
+
7
10
 
8
11
  class DataMasqueInstanceConfig(BaseModel):
9
12
  """
@@ -42,6 +45,10 @@ class DataMasqueInstanceConfig(BaseModel):
42
45
  Create the token in Snowsight (User profile → Programmatic access tokens)
43
46
  for an account that can reach the SPCS app.
44
47
  Leave unset for instances that are not hosted on SPCS."""
48
+ connect_timeout_seconds: float = DEFAULT_CONNECT_TIMEOUT_SECONDS
49
+ """How long a request may take to connect, including the TLS handshake."""
50
+ read_timeout_seconds: float = DEFAULT_READ_TIMEOUT_SECONDS
51
+ """How long a request may wait for the server between bytes of its response."""
45
52
 
46
53
  @model_validator(mode="after")
47
54
  def _validate_auth_source(self) -> "DataMasqueInstanceConfig":
@@ -6,6 +6,7 @@ from typing import Any, Callable, Optional
6
6
  from pydantic import BaseModel, ConfigDict, model_validator
7
7
 
8
8
  from datamasque.client.exceptions import DataMasqueUserError
9
+ from datamasque.client.models.dm_instance import DEFAULT_CONNECT_TIMEOUT_SECONDS, DEFAULT_READ_TIMEOUT_SECONDS
9
10
 
10
11
 
11
12
  class RulesetPlanOptions(BaseModel):
@@ -167,6 +168,10 @@ class DataMasqueIfmInstanceConfig(BaseModel):
167
168
  password: Optional[str] = None
168
169
  verify_ssl: bool = True
169
170
  token_source: Optional[Callable[[], str]] = None
171
+ connect_timeout_seconds: float = DEFAULT_CONNECT_TIMEOUT_SECONDS
172
+ """How long a request may take to connect, including the TLS handshake."""
173
+ read_timeout_seconds: float = DEFAULT_READ_TIMEOUT_SECONDS
174
+ """How long a request may wait for the server between bytes of its response."""
170
175
 
171
176
  @model_validator(mode="after")
172
177
  def _validate_auth_source(self) -> "DataMasqueIfmInstanceConfig":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: datamasque-python
3
- Version: 1.5.0
3
+ Version: 1.5.1
4
4
  Summary: Official Python client for the DataMasque data-masking API.
5
5
  Project-URL: Homepage, https://datamasque.com/
6
6
  Project-URL: Documentation, https://datamasque-python.readthedocs.io/
@@ -1,5 +1,5 @@
1
1
  datamasque/client/__init__.py,sha256=E763HBSVk3NOMI-sAchHwwAB1eG40A_6FN6vixNVJ4s,9021
2
- datamasque/client/base.py,sha256=cXU4dluL9e1N1F2pV48iIvebv6OHt7Kh4Ka2y9vkOPo,14296
2
+ datamasque/client/base.py,sha256=VMMn34yQRLZA44MHWrJe1pFLLRF-Z3LaA1gVtOiOyWk,14524
3
3
  datamasque/client/connections.py,sha256=EFinx8fJRme0mTxuWY3d29UnmUFbsQhMaUQT0Ma2PK4,2885
4
4
  datamasque/client/discovery.py,sha256=xidiAj5LdVSGQy6pjta_2Z_aJmuPPohblyNDfua_Mxk,28859
5
5
  datamasque/client/discovery_config_libraries.py,sha256=K6kFi7kL4SGIPKNIg1TBMIwHUeyfXI3Lyg5sknMMCD4,7285
@@ -7,7 +7,7 @@ datamasque/client/discovery_configs.py,sha256=-iSDi7g8PAYXJ8aGCusGOVtE1UWD4D_pNx
7
7
  datamasque/client/dmclient.py,sha256=0W6s26gUl9EZRL1kdk0R_7hgZSAOesY3H5wd-tN-QIE,1940
8
8
  datamasque/client/exceptions.py,sha256=3JI_LU8K3P2BCJDjGewzj3yg6oMd_7KuQ-zwSLR8Bfs,3956
9
9
  datamasque/client/files.py,sha256=vc2tZgT8RdwuCObIQ7H-Qjb80H1PBFqD0nG5Y1tOA_o,3503
10
- datamasque/client/ifm.py,sha256=uIMxpLIPvDiDO1m4bxezixNIUFIFY0MXWRMQNvTbpTA,11858
10
+ datamasque/client/ifm.py,sha256=KobUTxKvjDzQFPvwr7Ei3S1-UjDquSKVY0K7s9Mic1w,12099
11
11
  datamasque/client/license.py,sha256=pluYaSU168OC6_laB9bM9H3Vuuxs8wa9gujCJvtoJCk,1392
12
12
  datamasque/client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  datamasque/client/rg_configs.py,sha256=jcrbw-oMhj6o3Wsf8xy3peVo7DzeQ8EhhAsfcEwC3lc,5816
@@ -24,10 +24,10 @@ datamasque/client/models/data_selection.py,sha256=9hRpkQQIQlKGFYDYQCrreggsv96dh6
24
24
  datamasque/client/models/discovery.py,sha256=BvAK9zj0jwUc1O4DSluMcjeoYhF4HKOkJmO4uAhzet4,18222
25
25
  datamasque/client/models/discovery_config.py,sha256=8sqs9x_X0H_hR1fJDEFmOdJyGRDwgbdb3eddEAe98WE,2420
26
26
  datamasque/client/models/discovery_config_library.py,sha256=m0wI51Q4aHysLNHyNTWH3KrDLV_rxtoLNeKQsF9RYFk,1436
27
- datamasque/client/models/dm_instance.py,sha256=6h0WNlI1qt6jkrYFapIvuSJFkhRCcwbpx0PLG5NsrGw,2219
27
+ datamasque/client/models/dm_instance.py,sha256=Je1Ld66HxY_V7xFZxFSeqPE9ALg3VTpU0VNPVWcG-7w,2591
28
28
  datamasque/client/models/files.py,sha256=7hG3Q1-XYb1PF88l3ppsmBp2tjNtvQvv-RNTrOa7Nts,2784
29
29
  datamasque/client/models/git.py,sha256=F0KdMFe2vMyL-9tp3SGKGeOlbD1gbcjQn0jpOzNzybc,1782
30
- datamasque/client/models/ifm.py,sha256=j0Ef2BZYTk6MNZO6HS6mW0qWs1_wWD9PlUP_Y6WyBQI,5563
30
+ datamasque/client/models/ifm.py,sha256=1IVQfJsw3NOqK8vgVVcdtWdJHkw6IZI3PMlhkvwBNI0,5969
31
31
  datamasque/client/models/license.py,sha256=OqIn4Sx3ATBStgt5KNiCOBChTTFYLBsyGj7inAl8oB4,2113
32
32
  datamasque/client/models/pagination.py,sha256=egg9aO2cf6KUDwDANPu5RxpJbdRKdwUdCQAtusnuf1c,651
33
33
  datamasque/client/models/rg_config.py,sha256=g6g0qMTeR6OcM4Ji8fHrDOnOM5fsz1UYxntn_mv_k88,1792
@@ -38,7 +38,7 @@ datamasque/client/models/safe_data_preview.py,sha256=BiI9d13KdQrTin2JfbjiRiODjns
38
38
  datamasque/client/models/status.py,sha256=DXcucL_jRsOQ0vaV0t8CJt6crvCIOLBn07KuwpwW-4A,3247
39
39
  datamasque/client/models/table_reference.py,sha256=55fKdHjC2TQnUmbp0XiWqfeFGXqcq4wXjbWgMaN3p3c,3835
40
40
  datamasque/client/models/user.py,sha256=UGAUzgJkf78m24_zFXXoA99zdut48BXkX_ivV8yq1Vc,2043
41
- datamasque_python-1.5.0.dist-info/METADATA,sha256=8PhvPpCLdPzElNVWl_4CBcBFlTDsPiwly09VSmvoH6s,4497
42
- datamasque_python-1.5.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
43
- datamasque_python-1.5.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
44
- datamasque_python-1.5.0.dist-info/RECORD,,
41
+ datamasque_python-1.5.1.dist-info/METADATA,sha256=vHITd4Mix_f1Q4bX8jsWolqQzhsQ_8hViMUlrlEZ4Uc,4497
42
+ datamasque_python-1.5.1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
43
+ datamasque_python-1.5.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
44
+ datamasque_python-1.5.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.32.4
2
+ Generator: hatchling 1.33.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any