Commit be7c6ddb authored by Jo Sama's avatar Jo Sama 😱
Browse files

Filter search results, only return 1 operator

parent 8be45631
......@@ -93,8 +93,15 @@ class TopDeskClient:
return Operator.from_dict(self.get(url))
elif username:
url = self.urls.get_operators()
for x in self.get(url, params={'topdesk_login_name': username}):
yield Operator.from_dict(x)
operators = [Operator.from_dict(x) for x in
params={'topdesk_login_name': username})]
f = filter(lambda x: x.user_name.lower() == username,
return next(f)
except StopIteration:
return None
raise ValueError('identity or username must be set')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment