This topic describes how to delete a user in a tenant by using obshell-sdk-python.
Note
We recommend that you read through Get started with obshell-sdk-python to learn how to use obshell-sdk-python.
This API is supported starting with obshell V4.2.6.
Considerations
Make sure that obshell is running normally.
Make sure that the node corresponding to the client is in the initialized cluster.
Sample code
from obshell import ClientSet
from obshell.auth import PasswordAuth
# Create a client instance. The node address is '10.10.10.1' and the port is 2886.
client = ClientSet("10.10.10.1", 2886, PasswordAuth("****"))
# This example shows how to delete the user_1 user in the test tenant. If you want to delete a user in the sys tenant, you can omit the tenant_name and root_password parameters.
client.v1.drop_user("user_1", tenant_name="test", root_password="*****")
References
For more information about the API for deleting a user, see Delete a user.