user match

This commit is contained in:
mischa 2022-06-14 14:43:00 +02:00
parent 4653f0a09f
commit 42a87bf527
1 changed files with 7 additions and 4 deletions

View File

@ -91,12 +91,15 @@ 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 item.get('userName') == 'john': if re.match(r'ma', item.get('userName')):
user_id = item.get('id') user_id = item.get('id')
print(user_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}') ##r = alkira_delete(s, f'/users/{user_id}')
#print(r.text) ##print(r.text)