You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

30 lines
728 B

import sys
from thrift.server.TNonblockingServer import TNonblockingServer
from thrift.transport import TSocket
sys.path.append('/root/PixivSearch')
from PixivSearch.thrift.TestQry import TestQry
from PixivSearch.thrift.TestQry.ttypes import QryResult
class QueryImpl(TestQry.Iface):
def qryTest(self, qryCode):
result = QryResult()
if qryCode == 1:
result.code = 1
result.msg = 'success'
else:
result.code = 0
result.msg = 'fail'
return result
if __name__ == '__main__':
socket = TSocket.TServerSocket(port=2233)
processor = TestQry.Processor(QueryImpl())
server = TNonblockingServer(processor, socket)
server.serve()