def __init__(self): #接口地址配置 ipaddr = '10.32.173.200' #服务器地址 port = 8085 #端口号 projectname = '/XK_Phr_Proxy/UserServlet' transport = THttpClient.THttpClient( ipaddr, port, projectname) # ip port projectname self.transport = TTransport.TBufferedTransport(transport) protocol = TBinaryProtocol.TBinaryProtocol(transport) self.client = UserService.Client(protocol)
class conf_sys(object): #server transport = THttpClient.THttpClient(ipaddr, port, projectname) # ip port projectname transport = TTransport.TBufferedTransport(transport) protocol = TBinaryProtocol.TBinaryProtocol(transport) client = UserService.Client(protocol) #class a = ttypes.AccountInfo() a.accountName = 'M5A1CFEDBE4B09F03008C774D' a.accountName = '15040344536' a.password = '******' a.deviceId = 'awifidc:44:27:96:e9:ea' mif = ttypes.MemberInfo() cii = ttypes.CaregiverInfo() mdr = ttypes.MemberDoctorRelation() rif = ttypes.RecipeInfo() pif = ttypes.PhotoInfo() fif = ttypes.FamilyInfo()
sys.path.append('D:/thrift/gen-py') from ttypes import * import UserService import traceback import logging import assertpy sys.path.append('D:/thrift') from config import * from client_api import * transport = THttpClient.THttpClient( '10.32.173.200', 8085, '/XK_Phr_Proxy/UserServlet') # ip port projectname transport = TTransport.TBufferedTransport(transport) protocol = TBinaryProtocol.TBinaryProtocol(transport) client = UserService.Client(protocol) msg = MessageInfo() time1 = int(time.time()) msgtime = str(time1) print msg msg = { 'fromPerson': 'M5A1CFEDBE4B09F03008C774D', 'toPerson': 'M55FA54FBE4B0BB9D487A7D17', 'messageTime': msgtime, 'messageType': '1', 'messageContent': '123sgfdg', 'serviceid': '', 'deviceid': '', }