4848 target_name_option ,
4949 target_width_option ,
5050)
51+ from vws_cli .options .timeout import (
52+ connection_timeout_seconds_option ,
53+ read_timeout_seconds_option ,
54+ )
5155
5256
5357@beartype
@@ -131,13 +135,18 @@ def _base_vws_url_option(command: Callable[..., None]) -> Callable[..., None]:
131135@server_secret_key_option
132136@target_id_option
133137@_base_vws_url_option
138+ @connection_timeout_seconds_option
139+ @read_timeout_seconds_option
134140@_handle_vws_exceptions ()
135141@beartype
136142def get_target_record (
143+ * ,
137144 server_access_key : str ,
138145 server_secret_key : str ,
139146 target_id : str ,
140147 base_vws_url : str ,
148+ connection_timeout_seconds : float ,
149+ read_timeout_seconds : float ,
141150) -> None :
142151 """Get a target record.
143152
@@ -149,6 +158,10 @@ def get_target_record(
149158 server_access_key = server_access_key ,
150159 server_secret_key = server_secret_key ,
151160 base_vws_url = base_vws_url ,
161+ request_timeout_seconds = (
162+ connection_timeout_seconds ,
163+ read_timeout_seconds ,
164+ ),
152165 )
153166 record = vws_client .get_target_record (target_id = target_id ).target_record
154167
@@ -161,11 +174,15 @@ def get_target_record(
161174@server_secret_key_option
162175@_handle_vws_exceptions ()
163176@_base_vws_url_option
177+ @connection_timeout_seconds_option
178+ @read_timeout_seconds_option
164179@beartype
165180def list_targets (
166181 server_access_key : str ,
167182 server_secret_key : str ,
168183 base_vws_url : str ,
184+ connection_timeout_seconds : float ,
185+ read_timeout_seconds : float ,
169186) -> None :
170187 """List targets.
171188
@@ -177,6 +194,10 @@ def list_targets(
177194 server_access_key = server_access_key ,
178195 server_secret_key = server_secret_key ,
179196 base_vws_url = base_vws_url ,
197+ request_timeout_seconds = (
198+ connection_timeout_seconds ,
199+ read_timeout_seconds ,
200+ ),
180201 )
181202 targets = vws_client .list_targets ()
182203 yaml_list = yaml .dump (data = targets )
@@ -189,12 +210,17 @@ def list_targets(
189210@target_id_option
190211@_handle_vws_exceptions ()
191212@_base_vws_url_option
213+ @connection_timeout_seconds_option
214+ @read_timeout_seconds_option
192215@beartype
193216def get_duplicate_targets (
217+ * ,
194218 server_access_key : str ,
195219 server_secret_key : str ,
196220 target_id : str ,
197221 base_vws_url : str ,
222+ connection_timeout_seconds : float ,
223+ read_timeout_seconds : float ,
198224) -> None :
199225 """Get a list of potential duplicate targets.
200226
@@ -206,6 +232,10 @@ def get_duplicate_targets(
206232 server_access_key = server_access_key ,
207233 server_secret_key = server_secret_key ,
208234 base_vws_url = base_vws_url ,
235+ request_timeout_seconds = (
236+ connection_timeout_seconds ,
237+ read_timeout_seconds ,
238+ ),
209239 )
210240 record = vws_client .get_duplicate_targets (target_id = target_id )
211241
@@ -218,11 +248,15 @@ def get_duplicate_targets(
218248@server_secret_key_option
219249@_handle_vws_exceptions ()
220250@_base_vws_url_option
251+ @connection_timeout_seconds_option
252+ @read_timeout_seconds_option
221253@beartype
222254def get_database_summary_report (
223255 server_access_key : str ,
224256 server_secret_key : str ,
225257 base_vws_url : str ,
258+ connection_timeout_seconds : float ,
259+ read_timeout_seconds : float ,
226260) -> None :
227261 """Get a database summary report.
228262
@@ -234,6 +268,10 @@ def get_database_summary_report(
234268 server_access_key = server_access_key ,
235269 server_secret_key = server_secret_key ,
236270 base_vws_url = base_vws_url ,
271+ request_timeout_seconds = (
272+ connection_timeout_seconds ,
273+ read_timeout_seconds ,
274+ ),
237275 )
238276 report = vws_client .get_database_summary_report ()
239277 yaml_report = yaml .dump (data = dataclasses .asdict (obj = report ))
@@ -246,12 +284,17 @@ def get_database_summary_report(
246284@target_id_option
247285@_handle_vws_exceptions ()
248286@_base_vws_url_option
287+ @connection_timeout_seconds_option
288+ @read_timeout_seconds_option
249289@beartype
250290def get_target_summary_report (
291+ * ,
251292 server_access_key : str ,
252293 server_secret_key : str ,
253294 target_id : str ,
254295 base_vws_url : str ,
296+ connection_timeout_seconds : float ,
297+ read_timeout_seconds : float ,
255298) -> None :
256299 """Get a target summary report.
257300
@@ -263,6 +306,10 @@ def get_target_summary_report(
263306 server_access_key = server_access_key ,
264307 server_secret_key = server_secret_key ,
265308 base_vws_url = base_vws_url ,
309+ request_timeout_seconds = (
310+ connection_timeout_seconds ,
311+ read_timeout_seconds ,
312+ ),
266313 )
267314 report = vws_client .get_target_summary_report (target_id = target_id )
268315 report_dict = dataclasses .asdict (obj = report )
@@ -278,12 +325,17 @@ def get_target_summary_report(
278325@target_id_option
279326@_handle_vws_exceptions ()
280327@_base_vws_url_option
328+ @connection_timeout_seconds_option
329+ @read_timeout_seconds_option
281330@beartype
282331def delete_target (
332+ * ,
283333 server_access_key : str ,
284334 server_secret_key : str ,
285335 target_id : str ,
286336 base_vws_url : str ,
337+ connection_timeout_seconds : float ,
338+ read_timeout_seconds : float ,
287339) -> None :
288340 """Delete a target.
289341
@@ -295,6 +347,10 @@ def delete_target(
295347 server_access_key = server_access_key ,
296348 server_secret_key = server_secret_key ,
297349 base_vws_url = base_vws_url ,
350+ request_timeout_seconds = (
351+ connection_timeout_seconds ,
352+ read_timeout_seconds ,
353+ ),
298354 )
299355
300356 vws_client .delete_target (target_id = target_id )
@@ -310,6 +366,8 @@ def delete_target(
310366@active_flag_option (allow_none = False )
311367@_handle_vws_exceptions ()
312368@_base_vws_url_option
369+ @connection_timeout_seconds_option
370+ @read_timeout_seconds_option
313371@beartype
314372def add_target (
315373 * ,
@@ -320,6 +378,8 @@ def add_target(
320378 image_file_path : Path ,
321379 active_flag_choice : ActiveFlagChoice ,
322380 base_vws_url : str ,
381+ connection_timeout_seconds : float ,
382+ read_timeout_seconds : float ,
323383 application_metadata : str | None = None ,
324384) -> None :
325385 """Add a target.
@@ -332,6 +392,10 @@ def add_target(
332392 server_access_key = server_access_key ,
333393 server_secret_key = server_secret_key ,
334394 base_vws_url = base_vws_url ,
395+ request_timeout_seconds = (
396+ connection_timeout_seconds ,
397+ read_timeout_seconds ,
398+ ),
335399 )
336400
337401 image_bytes = image_file_path .read_bytes ()
@@ -364,6 +428,8 @@ def add_target(
364428@target_id_option
365429@_handle_vws_exceptions ()
366430@_base_vws_url_option
431+ @connection_timeout_seconds_option
432+ @read_timeout_seconds_option
367433@beartype
368434def update_target (
369435 * ,
@@ -372,6 +438,8 @@ def update_target(
372438 target_id : str ,
373439 image_file_path : Path | None ,
374440 base_vws_url : str ,
441+ connection_timeout_seconds : float ,
442+ read_timeout_seconds : float ,
375443 name : str | None = None ,
376444 application_metadata : str | None = None ,
377445 active_flag_choice : ActiveFlagChoice | None = None ,
@@ -387,6 +455,10 @@ def update_target(
387455 server_access_key = server_access_key ,
388456 server_secret_key = server_secret_key ,
389457 base_vws_url = base_vws_url ,
458+ request_timeout_seconds = (
459+ connection_timeout_seconds ,
460+ read_timeout_seconds ,
461+ ),
390462 )
391463
392464 if image_file_path is None :
@@ -445,6 +517,8 @@ def update_target(
445517@server_secret_key_option
446518@target_id_option
447519@_base_vws_url_option
520+ @connection_timeout_seconds_option
521+ @read_timeout_seconds_option
448522@_handle_vws_exceptions ()
449523@beartype
450524def wait_for_target_processed (
@@ -454,6 +528,8 @@ def wait_for_target_processed(
454528 target_id : str ,
455529 seconds_between_requests : float ,
456530 base_vws_url : str ,
531+ connection_timeout_seconds : float ,
532+ read_timeout_seconds : float ,
457533 timeout_seconds : float ,
458534) -> None :
459535 """Wait for a target to be "processed". This is done by polling the VWS
@@ -463,6 +539,10 @@ def wait_for_target_processed(
463539 server_access_key = server_access_key ,
464540 server_secret_key = server_secret_key ,
465541 base_vws_url = base_vws_url ,
542+ request_timeout_seconds = (
543+ connection_timeout_seconds ,
544+ read_timeout_seconds ,
545+ ),
466546 )
467547
468548 try :
0 commit comments