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.
 
 
 
 

25 lines
671 B

import sys
from thrift.protocol import TBinaryProtocol
from thrift.transport import TSocket, TTransport
sys.path.append("/home/hua/PycharmProjects/PixivSearch")
from PixivSearch.thrift.TestQry.TestQry import Client
if __name__ == '__main__':
# Make socket
socket = TSocket.TSocket('127.0.0.1', 2233)
# Buffering is critical. Raw sockets are very slow
transport = TTransport.TFramedTransport(socket)
if not transport.isOpen():
transport.open()
# Wrap in a protocol
protocol = TBinaryProtocol.TBinaryProtocol(transport)
# Create a client to use the protocol encoder
client = Client(protocol)
print(client.qryTest(0))