From 0f8c132b0fe415d6b10220165f65e057c6bd2562 Mon Sep 17 00:00:00 2001 From: Julien Rossow-Greenberg Date: Fri, 23 Feb 2024 15:45:14 -0500 Subject: [PATCH] search people --- pytdx/tdx.py | 14 +++++++++++++- tests/test_tdx.py | 9 +++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/pytdx/tdx.py b/pytdx/tdx.py index 1b21c5a..056f1f6 100644 --- a/pytdx/tdx.py +++ b/pytdx/tdx.py @@ -537,7 +537,7 @@ def search_kb_articles( return [KnowledgeArticle(**item) for item in response] # - # PERSON + # People # def get_person( @@ -551,3 +551,15 @@ def get_person( response = self.__request("GET", url=url) return Person(**response) + + def search_people(self, search_payload: dict) -> List[Person]: + """ + Search People + { + "UserName": "jrossowg@villanova.edu", + } + """ + url = f"{self.people_url}/search" + + response = self.__request("POST", url=url, data=search_payload) + return [Person(**item) for item in response] diff --git a/tests/test_tdx.py b/tests/test_tdx.py index 5c5596f..5840844 100644 --- a/tests/test_tdx.py +++ b/tests/test_tdx.py @@ -117,6 +117,15 @@ def test_get_person(tdx_client): assert isinstance(result, Person) +def test_search_people(tdx_client): + result = tdx_client.search_people( + search_payload={ + "UserName": "jrossowg@villanova.edu", + } + ) + assert result[0].UID == "eb449a7d-df73-ee11-826a-0050f2f4736d" + + ### Admin tests """