Skip to content

Commit

Permalink
Throw exception on permissions error for list channel endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
oblogic7 committed Feb 7, 2020
1 parent f84c5ce commit 277c67d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion pyqvrpro/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ def get_snapshot(self, camera_guid):
def get_channel_list(self):
"""Get a list of available channels."""

return self._get('/qvrpro/qshare/StreamingOutput/channels')
resp = self._get('/qvrpro/qshare/StreamingOutput/channels')

if "message" in resp.keys():
if resp["message"] == "Insufficient permission.":
raise InsufficientPermissionsError(
"User must have Surveillance Management permission")

def get_channel_streams(self, guid):
"""Get streams for a specific channel."""
Expand Down Expand Up @@ -169,3 +174,8 @@ def _base_url(self):
class AuthenticationError(ConnectionError):
def __init__(self, msg):
super(AuthenticationError, self).__init__({msg: msg})


class InsufficientPermissionsError(AuthenticationError):
def __init__(self, msg):
super(AuthenticationError, self).__init__({msg: msg})
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
EMAIL = '[email protected]'
AUTHOR = 'Matt Snyder'
REQUIRES_PYTHON = '>=3.5.0'
VERSION = 0.44
VERSION = 0.45

# What packages are required for this module to be executed?
REQUIRED = [
Expand Down

0 comments on commit 277c67d

Please sign in to comment.