From d436244baa823f10705795ef4afdb5f8e3584d73 Mon Sep 17 00:00:00 2001 From: Mark Tripod Date: Tue, 12 Dec 2023 09:12:18 -0500 Subject: [PATCH] feat: add get_user_by_email() method to admin.py doc: add report_user_by_email.py to examples --- duo_client/admin.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/duo_client/admin.py b/duo_client/admin.py index 884c6c3..8e44953 100644 --- a/duo_client/admin.py +++ b/duo_client/admin.py @@ -728,6 +728,24 @@ def get_user_by_id(self, user_id): response = self.json_api_call('GET', path, {}) return response + def get_user_by_email(self, email): + """ + Returns user specified by email. + + email - User to fetch + + Returns user object. + + Raises RuntimeError on error. + """ + params = { + 'email': email, + } + response = self.json_api_call('GET', + '/admin/v1/users', + params) + return response + def get_users_by_name(self, username): """ Returns user specified by username.