diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-05-12 16:29:22 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-05-12 16:29:22 +0200 |
commit | 18a808617f60c30e7ed817d79050f5564d289eb0 (patch) | |
tree | 04d1f0d6657dd951d2665da2330e54ebe0bd6665 /pyload/remote/thriftbackend/ThriftClient.py | |
parent | Missing optional lib (diff) | |
download | pyload-18a808617f60c30e7ed817d79050f5564d289eb0.tar.xz |
Other import fixes (3)
Diffstat (limited to 'pyload/remote/thriftbackend/ThriftClient.py')
-rw-r--r-- | pyload/remote/thriftbackend/ThriftClient.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/pyload/remote/thriftbackend/ThriftClient.py b/pyload/remote/thriftbackend/ThriftClient.py index ecd4086fa..259b6eff6 100644 --- a/pyload/remote/thriftbackend/ThriftClient.py +++ b/pyload/remote/thriftbackend/ThriftClient.py @@ -1,20 +1,20 @@ # -*- coding: utf-8 -*- +import socket import sys -import thrift import traceback -from Protocol import Protocol -from Socket import Socket -from socket import error -from thrift.transport import TTransport -# from thrift.transport.TZlibTransport import TZlibTransport +import thrift + +from pyload.remote.thriftbackend.Protocol import Protocol +from pyload.remote.thriftbackend.Socket import Socket # modules should import ttypes from here, when want to avoid importing API from pyload.remote.thriftbackend.thriftgen.pyload import Pyload from pyload.remote.thriftbackend.thriftgen.pyload.ttypes import * -ConnectionClosed = TTransport.TTransportException + +ConnectionClosed = thrift.transport.TTransport.TTransportException class WrongLogin(Exception): @@ -36,7 +36,8 @@ class ThriftClient(object): self.createConnection(host, port) try: self.transport.open() - except error, e: + + except socket.error, e: if e.args and e.args[0] in (111, 10061): raise NoConnection else: @@ -45,7 +46,8 @@ class ThriftClient(object): try: correct = self.client.login(user, password) - except error, e: + + except socket.error, e: if e.args and e.args[0] == 104: # connection reset by peer, probably wants ssl try: @@ -74,8 +76,8 @@ class ThriftClient(object): def createConnection(self, host, port, ssl=False): self.socket = Socket(host, port, ssl) - self.transport = TTransport.TBufferedTransport(self.socket) -# self.transport = TZlibTransport(TTransport.TBufferedTransport(self.socket)) + self.transport = thrift.transport.TTransport.TBufferedTransport(self.socket) + # self.transport = thrift.transport.TZlibTransport.TZlibTransport(thrift.transport.TTransport.TBufferedTransport(self.socket)) protocol = Protocol(self.transport) self.client = Pyload.Client(protocol) |