Rev 412 | Rev 748 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
'''Created on 05-Aug-2010@author: ashish'''from shop2020.config.client.ConfigClient import ConfigClientfrom shop2020.utils.Utils import log_entryfrom thrift.transport import TSocketfrom thrift.transport.TTransport import TFramedTransportfrom thrift.protocol.TBinaryProtocol import TBinaryProtocolfrom shop2020.thriftpy.logistics import LogisticsServiceclass LogisticsClient:host = "localhost"port = "9010"def __init__(self):try:self.config_client = ConfigClient()self.host = self.config_client.get_property("logistics_service_hostname")self.port = self.config_client.get_property("logistics_service_port")except:self.host="localhost"self.port="9010"log_entry("error getting data from config")self.__start__()def __start__(self):self.transport = TSocket.TSocket(self.host, self.port)self.transport = TFramedTransport(self.transport)self.protocol = TBinaryProtocol(self.transport)self.client = LogisticsService.Client(self.protocol)self.transport.open()def get_client(self):return self.client