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.
 
 
 
 

29 lines
886 B

from thrift.protocol import TBinaryProtocol
from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory
from thrift.server.TNonblockingServer import TNonblockingServer
from thrift.transport import TSocket
from thrift.transport.TTransport import TFramedTransport
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.TSocket(port=2233)
processor = TestQry.Processor(QueryImpl())
server = TNonblockingServer(processor, socket, TBinaryProtocolFactory(), TFramedTransport())
server.serve()