summaryrefslogtreecommitdiff
path: root/yaksh/xmlrpc_clients.py
diff options
context:
space:
mode:
authorprathamesh2016-10-04 17:22:20 +0530
committerprathamesh2016-10-04 17:22:20 +0530
commit9c14e2b2026074234d9c977ca17b0c96b0789f6b (patch)
tree8b6c8e2438563e56631c2adf986e7cb16c33afb4 /yaksh/xmlrpc_clients.py
parentc5ae3d4589a71c3f3b9f622c7b67a04277269cde (diff)
parent91dd42214ba5ad88c5158b50a7746caa3841a883 (diff)
downloadonline_test-9c14e2b2026074234d9c977ca17b0c96b0789f6b.tar.gz
online_test-9c14e2b2026074234d9c977ca17b0c96b0789f6b.tar.bz2
online_test-9c14e2b2026074234d9c977ca17b0c96b0789f6b.zip
Merge branch 'master' of https://github.com/FOSSEE/online_test into edit_questionpaper
Resolved Conflicts: yaksh/views.py
Diffstat (limited to 'yaksh/xmlrpc_clients.py')
-rw-r--r--yaksh/xmlrpc_clients.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/yaksh/xmlrpc_clients.py b/yaksh/xmlrpc_clients.py
index 6bfe0d6..4da70dd 100644
--- a/yaksh/xmlrpc_clients.py
+++ b/yaksh/xmlrpc_clients.py
@@ -1,11 +1,19 @@
-from xmlrpclib import ServerProxy
+from __future__ import unicode_literals
import time
import random
import socket
import json
import urllib
+from six.moves import urllib
-from settings import SERVER_PORTS, SERVER_POOL_PORT
+try:
+ from xmlrpclib import ServerProxy
+except ImportError:
+ # The above import will not work on Python-3.x.
+ from xmlrpc.client import ServerProxy
+
+# Local imports
+from .settings import SERVER_PORTS, SERVER_POOL_PORT
class ConnectionError(Exception):
@@ -58,7 +66,8 @@ class CodeServerProxy(object):
return result
def _get_server(self):
- port = json.loads(urllib.urlopen(self.pool_url).read())
+ response = urllib.request.urlopen(self.pool_url)
+ port = json.loads(response.read().decode('utf-8'))
proxy = ServerProxy('http://localhost:%d' % port)
return proxy