Skip to content

Commit

Permalink
Returns empty dict if user or group doesnt have license (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
malkin0xb8 authored Aug 14, 2024
1 parent cc103b2 commit 3e8787c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
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:
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

0 comments on commit 3e8787c

Please sign in to comment.