diff --git a/odins_spear/exceptions.py b/odins_spear/exceptions.py index 6198972..4bbfbd1 100644 --- a/odins_spear/exceptions.py +++ b/odins_spear/exceptions.py @@ -121,4 +121,11 @@ class OSFileNotFound(OSError): """ def __str__(self) -> str: - return f"File can not be found, please check path and file name." \ No newline at end of file + 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." \ No newline at end of file diff --git a/odins_spear/methods/get.py b/odins_spear/methods/get.py index ddeb97f..50bf89e 100644 --- a/odins_spear/methods/get.py +++ b/odins_spear/methods/get.py @@ -1,5 +1,5 @@ from ..utils.formatting import format_filter_value - +from ..exceptions import * class Get(): @@ -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: + return response def group_call_center_bounced_calls(self, service_user_id: str): @@ -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.