from thrift.protocol import TBinaryProtocol from thrift.transport import TSocket, TTransport from PixivSearch.thrift.QueryComment.QueryComment import Client if __name__ == '__main__': socket = TSocket.TSocket('sukura.top', 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) cids = [7636499, 7636501, 7636500, 7636503, 7636504, 7636502, 7636509, 7636508, 7636506, 7636507, 7636505] print(client.commentSumMap(cids))