@@ -243,6 +243,14 @@ def _get_device_info(sdk, device_guid):
243243 help = "Limit devices to only those in the organization you specify. "
244244 "Note that child organizations will be included." ,
245245)
246+ page_size_option = click .option (
247+ "--page-size" ,
248+ required = False ,
249+ type = int ,
250+ default = 100 ,
251+ help = "Number of devices to retrieve per API call. "
252+ "Lower this value if you are getting timeouts when retrieving devices with backup info. Default: 100" ,
253+ )
246254
247255include_usernames_option = click .option (
248256 "--include-usernames" ,
@@ -323,6 +331,7 @@ def _get_device_info(sdk, device_guid):
323331 help = "Include devices only when 'creationDate' field is greater than the provided value. "
324332 "Argument format options are the same as --last-connected-before." ,
325333)
334+ @page_size_option
326335@format_option
327336@sdk_options ()
328337def list_devices (
@@ -340,6 +349,7 @@ def list_devices(
340349 last_connected_before ,
341350 created_after ,
342351 created_before ,
352+ page_size ,
343353 format ,
344354):
345355 """Get information about many devices."""
@@ -359,11 +369,12 @@ def list_devices(
359369 "userUid" ,
360370 ]
361371 df = _get_device_dataframe (
362- state .sdk ,
363- columns ,
364- active ,
365- org_uid ,
366- (include_backup_usage or include_total_storage ),
372+ sdk = state .sdk ,
373+ columns = columns ,
374+ page_size = page_size ,
375+ active = active ,
376+ org_uid = org_uid ,
377+ include_backup_usage = (include_backup_usage or include_total_storage ),
367378 )
368379 if exclude_most_recently_connected :
369380 most_recent = (
@@ -429,13 +440,13 @@ def _get_all_active_hold_memberships(sdk):
429440
430441
431442def _get_device_dataframe (
432- sdk , columns , active = None , org_uid = None , include_backup_usage = False
443+ sdk , columns , page_size , active = None , org_uid = None , include_backup_usage = False
433444):
434445 devices_generator = sdk .devices .get_all (
435446 active = active ,
436447 include_backup_usage = include_backup_usage ,
437448 org_uid = org_uid ,
438- page_size = 100 ,
449+ page_size = page_size ,
439450 )
440451 devices_list = []
441452 if include_backup_usage :
@@ -514,6 +525,7 @@ def _break_backup_usage_into_total_storage(backup_usage):
514525@inactive_option
515526@org_uid_option
516527@include_usernames_option
528+ @page_size_option
517529@format_option
518530@sdk_options ()
519531def list_backup_sets (
@@ -522,6 +534,7 @@ def list_backup_sets(
522534 inactive ,
523535 org_uid ,
524536 include_usernames ,
537+ page_size ,
525538 format ,
526539):
527540 """Get information about many devices and their backup sets."""
0 commit comments