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 all 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."
13 changes: 9 additions & 4 deletions odins_spear/methods/get.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ..utils.formatting import format_filter_value

from ..exceptions import *

class Get():

Expand Down 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:
import requests.exceptions
response = self.requester.get(endpoint, params=params)
except requests.exceptions.RequestException:
raise OSLicenseNonExistent
else:
malkin0xb8 marked this conversation as resolved.
Show resolved Hide resolved
return response


def group_call_center_bounced_calls(self, service_user_id: str):
Expand Down Expand Up @@ -179,7 +184,7 @@ def group_call_center_forced_forwarding(self, service_user_id: str):
}

return self.requester.get(endpoint, params=params)


def group_call_center_overflow(self, service_user_id):
"""Retrieves the forwarding number for a user when all call center agents are busy, along with any associated audio messages.
Expand Down