summaryrefslogtreecommitdiffstats
path: root/module/remote/JSONClient.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/remote/JSONClient.py')
-rw-r--r--module/remote/JSONClient.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/module/remote/JSONClient.py b/module/remote/JSONClient.py
index 52b712c81..9f678f5bd 100644
--- a/module/remote/JSONClient.py
+++ b/module/remote/JSONClient.py
@@ -1,10 +1,12 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from json_converter import loads, dumps
from urllib import urlopen, urlencode
from httplib import UNAUTHORIZED, FORBIDDEN
+from json_converter import loads, dumps
+from ttypes import Unauthorized, Forbidden
+
class JSONClient:
URL = "http://localhost:8001/api"
@@ -19,9 +21,9 @@ class JSONClient:
if ret.code == 500:
raise Exception("Remote Exception")
if ret.code == UNAUTHORIZED:
- raise Exception("Unauthorized")
+ raise Unauthorized()
if ret.code == FORBIDDEN:
- raise Exception("Forbidden")
+ raise Forbidden()
return ret.read()
def login(self, username, password):