Subversion Repositories SmartDukaan

Rev

Rev 384 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 384 Rev 574
Line 8... Line 8...
8
from thrift.transport import TSocket
8
from thrift.transport import TSocket
9
from thrift.transport.TTransport import TFramedTransport
9
from thrift.transport.TTransport import TFramedTransport
10
from thrift.protocol.TBinaryProtocol import TBinaryProtocol
10
from thrift.protocol.TBinaryProtocol import TBinaryProtocol
11
from shop2020.thriftpy.model.v1.catalog import InventoryService
11
from shop2020.thriftpy.model.v1.catalog import InventoryService
12
 
12
 
13
class InventoryClient:
13
class InventoryClient:    
14
    
-
 
15
    host = "localhost"
-
 
16
    port = "9001"
-
 
17
    
-
 
18
    def __init__(self):
14
    def __init__(self):
19
        try:
15
        try:
20
            self.config_client = ConfigClient()
16
            self.config_client = ConfigClient()
21
            self.host = self.config_client.get_property("catalog_service_server_host")
17
            self.host = self.config_client.get_property("catalog_service_server_host")
22
            self.port = self.config_client.get_property("catalog_service_server_port")
18
            self.port = self.config_client.get_property("catalog_service_server_port")
23
            
-
 
24
        except:
19
        except:
25
            log_entry("error getting data from config")
20
            log_entry("error getting data from config")
-
 
21
            self.host = "localhost"
-
 
22
            self.port = "9001"
-
 
23
        self.__start__()
26
        
24
        
27
    def __start__(self):
25
    def __start__(self):
28
        self.transport = TSocket.TSocket(self.host, self.port)
26
        self.transport = TSocket.TSocket(self.host, self.port)
29
        self.transport = TFramedTransport(self.transport)
27
        self.transport = TFramedTransport(self.transport)
30
        self.protocol = TBinaryProtocol(self.transport)    
28
        self.protocol = TBinaryProtocol(self.transport)