Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
'''Created on 28-Jun-2010@author: ashish'''from shop2020.config.client.ConfigClient import ConfigClientfrom shop2020.utils.Utils import log_entryfrom shop2020.thriftpy.datalogger import DataLoggerfrom thrift.protocol.TBinaryProtocol import TBinaryProtocolfrom thrift.transport.TTransport import TFramedTransportfrom thrift.transport.TSocket import TSocketclass DataLoggingClient:host = "localhost"port = "9007"def __init__(self):try:self.config_client = ConfigClient()self.host = self.config_client.get_property("datalogging_service_local_hostname")self.port = self.config_client.get_property("datalogging_service_local_wrapper_port")self.__start__()except:log_entry("DataLoggingClient","error getting data from config")def __start__(self):self.transport = TSocket(self.host, self.port)self.transport = TFramedTransport(self.transport)self.protocol = TBinaryProtocol(self.transport)self.client = DataLogger.Client(self.protocol)self.transport.open()def get_client(self):return self.client