@@ -424,6 +424,27 @@ def bulk_add(self, users: Iterable[UserItem]) -> JobItem:
424
424
-------
425
425
JobItem
426
426
The job that is started for adding the users in bulk.
427
+
428
+ Examples
429
+ --------
430
+ >>> import tableauserverclient as TSC
431
+ >>> server = TSC.Server('http://localhost')
432
+ >>> # Login to the server
433
+
434
+ >>> # Create a list of UserItem objects to add to the site
435
+ >>> users = [
436
+ >>> TSC.UserItem(name="user1", site_role="Unlicensed"),
437
+ >>> TSC.UserItem(name="user2", site_role="Explorer"),
438
+ >>> TSC.UserItem(name="user3", site_role="Creator"),
439
+ >>> ]
440
+
441
+ >>> # Set the domain name for the users
442
+ >>> for user in users:
443
+ >>> user.domain_name = "example.com"
444
+
445
+ >>> # Add the users to the site
446
+ >>> job = server.users.bulk_add(users)
447
+
427
448
"""
428
449
url = f"{ self .baseurl } /import"
429
450
# Allow for iterators to be passed into the function
@@ -451,6 +472,16 @@ def bulk_remove(self, users: Iterable[UserItem]) -> None:
451
472
Returns
452
473
-------
453
474
None
475
+
476
+ Examples
477
+ --------
478
+ >>> import tableauserverclient as TSC
479
+ >>> server = TSC.Server('http://localhost')
480
+ >>> # Login to the server
481
+
482
+ >>> # Find the users to remove
483
+ >>> example_users = server.users.filter(domain_name="example.com")
484
+ >>> server.users.bulk_remove(example_users)
454
485
"""
455
486
url = f"{ self .baseurl } /delete"
456
487
csv_content = remove_users_csv (users )
0 commit comments