Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Returns empty dict if user or group doesnt have license #78

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion odins_spear/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,11 @@ class OSFileNotFound(OSError):
"""

def __str__(self) -> str:
return f"File can not be found, please check path and file name."
return f"File can not be found, please check path and file name."

class OSLicenseNonExistent(OSError):
""" Raised when the Specified Entity doesn't exist due to licensing.
"""

def __str__(self) -> str:
return f"Specified Entity doesn't have the correct License."
17 changes: 14 additions & 3 deletions odins_spear/methods/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,13 @@ def user_call_center(self, user_id: str):
params = {
"userId": user_id
}

return self.requester.get(endpoint, params=params)
try:
self.requester.get(endpoint, params=params)
malkin0xb8 marked this conversation as resolved.
Show resolved Hide resolved
except Exception as error: # If user is not found
if "404" in str(error):
return dict([]) # Return empty dict
malkin0xb8 marked this conversation as resolved.
Show resolved Hide resolved
else:
malkin0xb8 marked this conversation as resolved.
Show resolved Hide resolved
return


def group_call_center_bounced_calls(self, service_user_id: str):
Expand Down Expand Up @@ -178,7 +183,13 @@ def group_call_center_forced_forwarding(self, service_user_id: str):
"serviceUserId": service_user_id
}

return self.requester.get(endpoint, params=params)
try:
self.requester.get(endpoint, params=params)
except Exception as error: # If service is not found
if "404" in str(error):
return dict([]) # Return empty dict
else:
return


def group_call_center_overflow(self, service_user_id):
Expand Down