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