summaryrefslogtreecommitdiffstats
path: root/module/remote/thriftbackend/ThriftClient.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/remote/thriftbackend/ThriftClient.py')
-rw-r--r--module/remote/thriftbackend/ThriftClient.py36
1 files changed, 9 insertions, 27 deletions
diff --git a/module/remote/thriftbackend/ThriftClient.py b/module/remote/thriftbackend/ThriftClient.py
index 74363cf62..7c2a1cb01 100644
--- a/module/remote/thriftbackend/ThriftClient.py
+++ b/module/remote/thriftbackend/ThriftClient.py
@@ -2,13 +2,17 @@
import sys
from socket import error
-from os.path import dirname, abspath, join
from traceback import print_exc
try:
import thrift
+
except ImportError:
- sys.path.append(abspath(join(dirname(abspath(__file__)), "..", "..", "lib")))
+ import platform
+
+ if "64" in platform.machine():
+ sys.path.append(os.path.join(pypath, "lib64"))
+ sys.path.append(os.path.join(pypath, "lib"))
from thrift.transport import TTransport
#from thrift.transport.TZlibTransport import TZlibTransport
@@ -17,8 +21,8 @@ from Protocol import Protocol
# modules should import ttypes from here, when want to avoid importing API
-from thriftgen.pyload import Pyload
-from thriftgen.pyload.ttypes import *
+from pyload.remote.thriftbackend.thriftgen.pyload import Pyload
+from pyload.remote.thriftbackend.thriftgen.pyload.ttypes import *
ConnectionClosed = TTransport.TTransportException
@@ -31,7 +35,7 @@ class NoConnection(Exception):
class NoSSL(Exception):
pass
-class ThriftClient:
+class ThriftClient(object):
def __init__(self, host="localhost", port=7227, user="", password=""):
self.createConnection(host, port)
@@ -85,25 +89,3 @@ class ThriftClient:
def __getattr__(self, item):
return getattr(self.client, item)
-
-if __name__ == "__main__":
-
- client = ThriftClient(user="User", password="pwhere")
-
- print client.getServerVersion()
- print client.statusServer()
- print client.statusDownloads()
- q = client.getQueue()
-
-# for p in q:
-# data = client.getPackageData(p.pid)
-# print data
-# print "Package Name: ", data.name
-
-
- print client.getServices()
- print client.call(Pyload.ServiceCall("UpdateManager", "recheckForUpdates"))
-
- print client.getConfigValue("download", "limit_speed", "core")
-
- client.close() \ No newline at end of file