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.

27 lines
678 B

7 years ago
from thrift.server.TNonblockingServer import TNonblockingServer
from thrift.transport import TSocket
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__':
7 years ago
socket = TSocket.TServerSocket(port=2233)
7 years ago
processor = TestQry.Processor(QueryImpl())
7 years ago
server = TNonblockingServer(processor, socket)
7 years ago
server.serve()