00
This commit is contained in:
parent
42a87bf527
commit
4b8cd8bd8f
21
api-02.py
21
api-02.py
@ -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)
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user