This commit is contained in:
mischa 2022-06-14 14:59:05 +02:00
parent 42a87bf527
commit 4b8cd8bd8f
2 changed files with 8 additions and 13 deletions

View File

View File

@ -78,28 +78,23 @@ data = r.json()
print(data[0]['name'])
print(data[0]['id'])
#body = {"email": "john@abc.com",
#"firstName": "John",
#"lastName": "Doe",
#"password": "string",
#"roles": ["netadmin"],
#"userName": "john"}
#body = {"email": "john@abcde.com", "firstName": "John", "lastName": "Doe", "password": "string", "roles": ["netadmin"], "userName": "john2"}
#r = alkira_post(s, '/users', body)
#print(r.text)
#print(r.status_code)
r = alkira_get(s, '/users')
data = r.json()
print(json.dumps(data, indent=4))
#print(json.dumps(data, indent=4))
for item in data:
if re.match(r'ma', item.get('userName')):
if re.match(r'john', item.get('userName')):
user_id = item.get('id')
username = item.get('userName')
firstname = item.get('firstName')
lastname = item.get('lastName')
print(f"First: {firstname}\n Last: {lastname}\n Login: {username}\n ID: {user_id}")
##r = alkira_delete(s, f'/users/{user_id}')
##print(r.text)
#print(f"First: {firstname}\n Last: {lastname}\n Login: {username}\n ID: {user_id}")
print(f'Deleting {username}')
r = alkira_delete(s, f'/users/{user_id}')
print(r.status_code)