From 972e42fa36b41d9e219a1b7810e7f7f77f47e75d Mon Sep 17 00:00:00 2001 From: WuXianChaoPin <1029559041@qq.com> Date: Wed, 2 May 2018 18:48:44 +0800 Subject: [PATCH] thift --- PixivSearch/aliyun/photo/AliyunPhoto.py | 1 - PixivSearch/thrift/TestQry/Client.py | 2 +- PixivSearch/thrift/TestQry/Server.py | 7 ++----- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/PixivSearch/aliyun/photo/AliyunPhoto.py b/PixivSearch/aliyun/photo/AliyunPhoto.py index 615ffad..a81f1dc 100644 --- a/PixivSearch/aliyun/photo/AliyunPhoto.py +++ b/PixivSearch/aliyun/photo/AliyunPhoto.py @@ -66,7 +66,6 @@ class MyClient(AcsClient): self.listPhotoStores() request = CreateTransactionRequest.CreateTransactionRequest() filePath = input('输入上传文件路径\n').replace('\\', '/') - filePath = 'C:/Users/47418/Desktop/照片/IMG_20170218_212837.jpg' fileName = filePath.split('/')[-1] request.set_Size(os.path.getsize(filePath)) request.set_Ext(fileName[-fileName[::-1].index('.'):]) diff --git a/PixivSearch/thrift/TestQry/Client.py b/PixivSearch/thrift/TestQry/Client.py index 2839dc7..22237b5 100644 --- a/PixivSearch/thrift/TestQry/Client.py +++ b/PixivSearch/thrift/TestQry/Client.py @@ -22,4 +22,4 @@ if __name__ == '__main__': # Create a client to use the protocol encoder client = Client(protocol) - print(client.qryTest(0)) + print(client.qryTest(1)) diff --git a/PixivSearch/thrift/TestQry/Server.py b/PixivSearch/thrift/TestQry/Server.py index de53097..4e78d52 100644 --- a/PixivSearch/thrift/TestQry/Server.py +++ b/PixivSearch/thrift/TestQry/Server.py @@ -1,8 +1,5 @@ -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 @@ -22,8 +19,8 @@ class QueryImpl(TestQry.Iface): if __name__ == '__main__': - socket = TSocket.TSocket(port=2233) + socket = TSocket.TServerSocket(port=2233) processor = TestQry.Processor(QueryImpl()) - server = TNonblockingServer(processor, socket, TBinaryProtocolFactory(), TFramedTransport()) + server = TNonblockingServer(processor, socket) server.serve()